rspec-example_steps 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## RSpec example steps
2
2
 
3
- Given/When/Then steps for RSpec examples
3
+ Given/When/Then/And/But steps for RSpec examples
4
4
 
5
5
  ### Example
6
6
 
@@ -38,6 +38,25 @@ module RSpec
38
38
  end
39
39
  end
40
40
 
41
+ def And(message, options = {})
42
+ RSpec.world.reporter.example_step_started(self, :and, message, options)
43
+ if block_given? && !options[:pending]
44
+ yield
45
+ RSpec.world.reporter.example_step_passed(self, :and, message, options)
46
+ else
47
+ RSpec.world.reporter.example_step_pending(self, :and, message, options)
48
+ end
49
+ end
50
+
51
+ def But(message, options = {})
52
+ RSpec.world.reporter.example_step_started(self, :but, message, options)
53
+ if block_given? && !options[:pending]
54
+ yield
55
+ RSpec.world.reporter.example_step_passed(self, :but, message, options)
56
+ else
57
+ RSpec.world.reporter.example_step_pending(self, :but, message, options)
58
+ end
59
+ end
41
60
  end
42
61
  end
43
62
  end
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "rspec-example_steps"
6
- s.version = "0.1.1"
6
+ s.version = "0.1.2"
7
7
  s.authors = ["Andriy Yanko"]
8
8
  s.email = ["andriy.yanko@gmail.com"]
9
9
  s.homepage = "https://github.com/railsware/rspec-example_steps"
@@ -17,9 +17,19 @@ describe "example steps" do
17
17
  @result = "Then value"
18
18
  end
19
19
 
20
+ And "and" do
21
+ @and = "And value"
22
+ end
23
+
24
+ But "but" do
25
+ @but = "But value"
26
+ end
27
+
20
28
  @thing.should == "Given value"
21
29
  @action.should == "When value"
22
30
  @result.should == "Then value"
31
+ @and.should == "And value"
32
+ @but.should == "But value"
23
33
  end
24
34
  end
25
35
 
@@ -45,6 +55,14 @@ describe "example steps" do
45
55
  Then "then step with :pending option", :pending => true do
46
56
  raise "Should not be evaluated"
47
57
  end
58
+
59
+ And "and step with :pending option", :pending => true do
60
+ raise "Should not be evaluated"
61
+ end
62
+
63
+ But "and step with :pending option", :pending => true do
64
+ raise "Should not be evaluated"
65
+ end
48
66
  end
49
67
 
50
68
  Steps "they should be pending when :pending => STRING" do
@@ -70,6 +88,12 @@ describe "example steps" do
70
88
 
71
89
  Then "then step with :pending option", :pending => false do
72
90
  end
91
+
92
+ And "and step with :pending option", :pending => false do
93
+ end
94
+
95
+ But "and step with :pending option", :pending => false do
96
+ end
73
97
  end
74
98
  end
75
99
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-example_steps
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andriy Yanko