aruba-rspec 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad4d4ae4e068e08a82846cb71d3f0f18d4bc4b78
4
- data.tar.gz: 144ca0a998ecb3cad58dbcfa5fe56ca63f93dbc4
3
+ metadata.gz: 923609312c5295afcd0dfe8225f4584b74a7742a
4
+ data.tar.gz: 4d854607fbfde128363436f7013669d711e59ee5
5
5
  SHA512:
6
- metadata.gz: 0cd2c31da70965e40e13f3296699e1e68b204cdd5ff53c6757dda7d8258098580db353212441a8c135e35bc465c232b6068ba0361093b6dbc6ffac9a2304ca29
7
- data.tar.gz: fff22a8d67e9651104cb87b5e68cb0bbe3414439578b1ad720db244efde2c798140617e76279eb37968df3cacd6457fe1def8f7628d65303ad2c5cad518f6f56
6
+ metadata.gz: ba391b19a6c0ddae026fe758ca5cc4c1cec3d026e4ca2eed7668daec6663841d78549a6aa88b60151d24c5048a88292ba9f62847b8ddc883a5706a933b71708f
7
+ data.tar.gz: 6c386cd7f82932ead728d67f577c40a93a440d4738586dac62b7b70d064c0a1bf7dc8ca87de13644d27665bfb9e83ebd57df4399c52426fb425b53a8b8f4d22b
data/Gemfile CHANGED
@@ -5,4 +5,7 @@ gemspec
5
5
 
6
6
  group :development, :test do
7
7
  gem 'rspec'
8
- end
8
+ gem 'guard-rspec'
9
+ gem 'guard-bundler'
10
+ gem 'pry-nav'
11
+ end
data/Guardfile ADDED
@@ -0,0 +1,14 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :bundler do
5
+ watch('Gemfile')
6
+ watch(/^.+\.gemspec/)
7
+ end
8
+
9
+ guard :rspec do
10
+ watch(%r{^spec/.+_spec\.rb$})
11
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
12
+ watch('spec/spec_helper.rb') { "spec" }
13
+ end
14
+
data/README.md CHANGED
@@ -77,6 +77,16 @@ describe MyThing do
77
77
  end
78
78
  ```
79
79
 
80
+ ### :have_exit_status
81
+
82
+ ```ruby
83
+ it 'exits 50' do
84
+ double_cmd('thing', exit: 50)
85
+ expect {
86
+ `thing 1 2 3`
87
+ }.to have_exit_status(50)
88
+ ```
89
+
80
90
  ## References
81
91
 
82
92
  * `https://github.com/cucumber/aruba`
@@ -1 +1,2 @@
1
+ require 'aruba/rspec/matchers/have_exit_status'
1
2
  require 'aruba/rspec/matchers/shellout'
@@ -0,0 +1,19 @@
1
+ RSpec::Matchers.define :have_exit_status do |status|
2
+ match do |ruby|
3
+ raise ArgumentError, "expected should be a Proc" unless ruby.respond_to?(:call)
4
+ ruby.call
5
+ $?.exitstatus == status
6
+ end
7
+
8
+ failure_message_for_should do |ruby|
9
+ "expected that code would exit #{status}"
10
+ end
11
+
12
+ failure_message_for_should_not do |ruby|
13
+ "expected that code would NOT exit #{status}"
14
+ end
15
+
16
+ description do
17
+ "exit #{status}"
18
+ end
19
+ end
@@ -1,5 +1,5 @@
1
1
  module Aruba
2
2
  module RSpec
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'have_exit_status matcher' do
4
+ before { Aruba::RSpec.setup }
5
+ after { Aruba::RSpec.teardown }
6
+
7
+ describe 'validations' do
8
+ it 'raises unless given a proc' do
9
+ expect {
10
+ expect(nil).to shellout('thing')
11
+ }.to raise_error(ArgumentError, 'expected should be a Proc')
12
+ end
13
+ end
14
+
15
+ context 'when command exit status matches expectations' do
16
+ it 'succeeds' do
17
+ double_cmd('thing', exit: 100)
18
+ expect { `thing` }.to have_exit_status(100)
19
+ end
20
+ end
21
+
22
+ context 'when command exit status fails expectations' do
23
+ it 'fails' do
24
+ double_cmd('thing', exit: 101)
25
+ expect {
26
+ expect { `thing` }.to have_exit_status(100)
27
+ }.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected that code would exit 100/)
28
+ end
29
+ end
30
+ end
@@ -17,7 +17,7 @@ describe 'shellout matcher' do
17
17
  double_cmd('thing')
18
18
  expect { `thing` }.to shellout('thing')
19
19
  end
20
-
20
+
21
21
  it 'matches arguments' do
22
22
  double_cmd('thing')
23
23
  expect { `thing --with --stuff` }.to shellout('thing --with --stuff')
@@ -1,4 +1,32 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Aruba::RSpec do
4
- end
4
+ describe '::history' do
5
+ it 'should be an ArubaDoubles::History' do
6
+ expect(Aruba::RSpec.history).to be_an(ArubaDoubles::History)
7
+ end
8
+ end
9
+
10
+ describe '::setup' do
11
+ it 'sets up ArubaDoubles' do
12
+ ArubaDoubles::Double.stub(:setup)
13
+ Aruba::RSpec.setup
14
+ expect(ArubaDoubles::Double).to have_received(:setup)
15
+ end
16
+ end
17
+
18
+ describe '::teardown' do
19
+ before { ArubaDoubles::Double.stub(:teardown) }
20
+
21
+ it 'tears down ArubaDoubles' do
22
+ Aruba::RSpec.teardown
23
+ expect(ArubaDoubles::Double).to have_received(:teardown)
24
+ end
25
+
26
+ it 'clears the history' do
27
+ Aruba::RSpec.history.stub(:clear)
28
+ Aruba::RSpec.teardown
29
+ expect(Aruba::RSpec.history).to have_received(:clear)
30
+ end
31
+ end
32
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aruba-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Saxby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-02 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -91,14 +91,17 @@ files:
91
91
  - ".gitignore"
92
92
  - ".rspec"
93
93
  - Gemfile
94
+ - Guardfile
94
95
  - LICENSE.txt
95
96
  - README.md
96
97
  - Rakefile
97
98
  - aruba-rspec.gemspec
98
99
  - lib/aruba/rspec.rb
99
100
  - lib/aruba/rspec/matchers.rb
101
+ - lib/aruba/rspec/matchers/have_exit_status.rb
100
102
  - lib/aruba/rspec/matchers/shellout.rb
101
103
  - lib/aruba/rspec/version.rb
104
+ - spec/aruba/rspec/matchers/have_exit_status_spec.rb
102
105
  - spec/aruba/rspec/matchers/shellout_spec.rb
103
106
  - spec/aruba/rspec_spec.rb
104
107
  - spec/spec_helper.rb
@@ -127,6 +130,8 @@ signing_key:
127
130
  specification_version: 4
128
131
  summary: Bridge RSpec and Aruba to test command-line tools
129
132
  test_files:
133
+ - spec/aruba/rspec/matchers/have_exit_status_spec.rb
130
134
  - spec/aruba/rspec/matchers/shellout_spec.rb
131
135
  - spec/aruba/rspec_spec.rb
132
136
  - spec/spec_helper.rb
137
+ has_rdoc: