aruba-doubles 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'aruba-doubles'
5
- s.version = '1.2.0'
5
+ s.version = '1.2.1'
6
6
  s.authors = ['Björn Albers']
7
7
  s.email = ['bjoernalbers@googlemail.com']
8
8
  s.description = 'Cucumber Steps to double Command Line Applications'
@@ -40,9 +40,11 @@ Given /^I double `([^`]*)` with exit status (\d+)$/ do |cmd, exit_status|
40
40
  end
41
41
 
42
42
  Then /^the double `([^`]*)` should have been run$/ do |cmd|
43
- history.should include(cmd.shellsplit)
43
+ history.should include(cmd.shellsplit),
44
+ "expected the doubles history to include `#{cmd}`:\n#{history.to_pretty}"
44
45
  end
45
46
 
46
47
  Then /^the double `([^`]*)` should not have been run$/ do |cmd|
47
- history.should_not include(cmd.shellsplit)
48
+ history.should_not include(cmd.shellsplit),
49
+ "expected the doubles history to not include `#{cmd}`:\n#{history.to_pretty}"
48
50
  end
@@ -24,6 +24,17 @@ module ArubaDoubles
24
24
  entries.each { |e| yield(e) }
25
25
  end
26
26
 
27
+ # @return [String] inspection of the entries
28
+ def to_s
29
+ to_a.inspect
30
+ end
31
+
32
+ # Return entries just like running `history` in your shell.
33
+ # @return [String] pretty representation of the entries
34
+ def to_pretty
35
+ to_a.each_with_index.map { |e,i| "%5d %s" % [i+1, e.shelljoin] }.join("\n")
36
+ end
37
+
27
38
  private
28
39
 
29
40
  def entries
@@ -1,12 +1,37 @@
1
1
  require 'spec_helper'
2
2
 
3
+ module ArubaDoubles
4
+ describe History do
5
+ before do
6
+ PStore.stub(:new)
7
+ @history = History.new('history.pstore')
8
+ end
3
9
 
4
- describe ArubaDoubles::History do
10
+ #TODO: Add examples to test the transactional stuff with PStore!
5
11
 
6
- #TODO: Add examples to test the transactional stuff with PStore!
12
+ it 'should initialize a PStore with the filename' do
13
+ PStore.should_receive(:new).with('history.pstore')
14
+ History.new('history.pstore')
15
+ end
7
16
 
8
- it 'should initialize a PStore with the filename' do
9
- PStore.should_receive(:new).with('history.pstore')
10
- ArubaDoubles::History.new('history.pstore')
17
+ describe '#to_s' do
18
+ it 'should return an inspection of the entries' do
19
+ @history.stub_chain(:to_a, :inspect).and_return('entries')
20
+ @history.to_s.should eql('entries')
21
+ end
22
+ end
23
+
24
+ describe '#to_pretty' do
25
+ it 'should return a pretty representation to the entries' do
26
+ entries = []
27
+ entries << ['foo']
28
+ entries << ['foo', '--bar']
29
+ entries << ['foo', '--bar', 'hello, world.']
30
+ @history.stub(:to_a).and_return(entries)
31
+ @history.to_pretty.should include('1 foo')
32
+ @history.to_pretty.should include('2 foo --bar')
33
+ @history.to_pretty.should include('3 foo --bar hello,\ world.')
34
+ end
35
+ end
11
36
  end
12
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aruba-doubles
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
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-04-21 00:00:00.000000000Z
12
+ date: 2012-04-25 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
16
- requirement: &70241989258120 !ruby/object:Gem::Requirement
16
+ requirement: &70355755452560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.0.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70241989258120
24
+ version_requirements: *70355755452560
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70241989257520 !ruby/object:Gem::Requirement
27
+ requirement: &70355755452000 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.6.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70241989257520
35
+ version_requirements: *70355755452000
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70241989256900 !ruby/object:Gem::Requirement
38
+ requirement: &70355755451320 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.9.2.2
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70241989256900
46
+ version_requirements: *70355755451320
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: aruba
49
- requirement: &70241989256280 !ruby/object:Gem::Requirement
49
+ requirement: &70355755450680 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.4.6
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70241989256280
57
+ version_requirements: *70355755450680
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-cucumber
60
- requirement: &70241989255780 !ruby/object:Gem::Requirement
60
+ requirement: &70355755450120 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.7.3
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70241989255780
68
+ version_requirements: *70355755450120
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard-rspec
71
- requirement: &70241989255140 !ruby/object:Gem::Requirement
71
+ requirement: &70355755449540 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 0.5.1
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70241989255140
79
+ version_requirements: *70355755449540
80
80
  description: Cucumber Steps to double Command Line Applications
81
81
  email:
82
82
  - bjoernalbers@googlemail.com
@@ -119,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  segments:
121
121
  - 0
122
- hash: -2111762355513459524
122
+ hash: -1680891879289876607
123
123
  required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  none: false
125
125
  requirements:
@@ -128,13 +128,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  segments:
130
130
  - 0
131
- hash: -2111762355513459524
131
+ hash: -1680891879289876607
132
132
  requirements: []
133
133
  rubyforge_project:
134
134
  rubygems_version: 1.8.10
135
135
  signing_key:
136
136
  specification_version: 3
137
- summary: aruba-doubles-1.2.0
137
+ summary: aruba-doubles-1.2.1
138
138
  test_files:
139
139
  - features/define_output.feature
140
140
  - features/double_commands.feature