bahia 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/CHANGELOG.rdoc +3 -0
  2. data/lib/bahia.rb +5 -2
  3. data/spec/bahia_spec.rb +15 -10
  4. metadata +17 -7
@@ -1,3 +1,6 @@
1
+ == 0.7.0
2
+ * More user-friendly message for failed autodetection
3
+
1
4
  == 0.6.0
2
5
  * Fix overriding project_directory and command
3
6
  * Actually auto detect project_directory for rspec
@@ -2,11 +2,11 @@ require 'open3'
2
2
  require 'shellwords'
3
3
 
4
4
  module Bahia
5
- VERSION = '0.6.0'
5
+ VERSION = '0.7.0'
6
6
 
7
7
  class DetectionError < StandardError
8
8
  def initialize(name)
9
- super "Unable to detect #{name}. Set it with Bahia.#{name}"
9
+ super "Unable to detect #{name}. Set Bahia.#{name} before including Bahia."
10
10
  end
11
11
  end
12
12
 
@@ -23,6 +23,9 @@ module Bahia
23
23
  define_method(command_method) do |*cmd|
24
24
  @stdout, @stderr, @process = Bahia.run_command(cmd.shift || '')
25
25
  end
26
+ rescue DetectionError => err
27
+ msg = "bahia: #{err}"
28
+ abort "\n" + "*" * msg.size + "\n#{msg}\n" + "*" * msg.size + "\n\n"
26
29
  end
27
30
 
28
31
  def self.run_command(cmd)
@@ -17,29 +17,34 @@ describe Bahia do
17
17
  subject { test_class.send :include, Bahia }
18
18
 
19
19
  context "fails to include and raises DetectionError" do
20
+ def error(ivar)
21
+ msg = "bahia: " + Bahia::DetectionError.new(ivar).message
22
+ "\n" + "*" * msg.size + "\n#{msg}\n" + "*" * msg.size + "\n\n"
23
+ end
24
+
20
25
  it "if directory not detected" do
21
- Bahia.should_receive(:caller).and_return(["(eval)"])
22
- msg = Bahia::DetectionError.new(:project_directory).message
23
- expect { subject }.to raise_error(msg)
26
+ Bahia.should_receive(:caller).at_least(1).and_return(["(eval)"])
27
+ Bahia.should_receive(:abort).with error(:project_directory)
28
+ subject
24
29
  end
25
30
 
26
31
  it "if directory does not exist" do
27
- Bahia.should_receive(:caller).and_return(["(irb):5"])
28
- msg = Bahia::DetectionError.new(:project_directory).message
29
- expect { subject }.to raise_error(msg)
32
+ Bahia.should_receive(:caller).at_least(1).and_return(["(irb):5"])
33
+ Bahia.should_receive(:abort).with error(:project_directory)
34
+ subject
30
35
  end
31
36
 
32
37
  it "if test directory is not test or spec" do
33
38
  stub_directory '/dir/my_test'
34
- msg = Bahia::DetectionError.new(:project_directory).message
35
- expect { subject }.to raise_error(msg)
39
+ Bahia.should_receive(:abort).with error(:project_directory)
40
+ subject
36
41
  end
37
42
 
38
43
  it "if command isn't detected" do
39
44
  stub_directory '/dir/spec'
40
45
  Dir.should_receive(:[]).with('/dir/bin/*').and_return([])
41
- msg = Bahia::DetectionError.new(:command).message
42
- expect { subject }.to raise_error(msg)
46
+ Bahia.should_receive(:abort).with error(:command)
47
+ subject
43
48
  end
44
49
  end
45
50
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bahia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-17 00:00:00.000000000 Z
12
+ date: 2012-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: open4
16
- requirement: &70110518358440 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 1.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70110518358440
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.3.0
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rspec
27
- requirement: &70110518357520 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: 2.8.0
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70110518357520
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.8.0
36
46
  description: Bahia - where commandline acceptance tests are easy, the people are festive
37
47
  and onde nasceu capoeira. In other words, aruba for any non-cucumber test framework.
38
48
  email: gabriel.horner@gmail.com
@@ -73,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
83
  version: 1.3.6
74
84
  requirements: []
75
85
  rubyforge_project:
76
- rubygems_version: 1.8.11
86
+ rubygems_version: 1.8.19
77
87
  signing_key:
78
88
  specification_version: 3
79
89
  summary: aruba for non-cucumber test frameworks