rspec-given 1.2.0 → 1.3.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.
- data/examples/stack/stack_spec.rb +4 -4
- data/lib/rspec/given/extensions.rb +14 -0
- data/lib/rspec/given/version.rb +1 -1
- metadata +3 -3
@@ -26,7 +26,7 @@ describe Stack do
|
|
26
26
|
|
27
27
|
Then { stack.depth.should == 0 }
|
28
28
|
|
29
|
-
|
29
|
+
Scenario "pushing onto an empty stack" do
|
30
30
|
When { stack.push(:an_item) }
|
31
31
|
|
32
32
|
Then { stack.depth.should == 1 }
|
@@ -37,7 +37,7 @@ describe Stack do
|
|
37
37
|
context "a stack with one item do" do
|
38
38
|
Given(:stack) { a_stack_with_one_item }
|
39
39
|
|
40
|
-
|
40
|
+
Scenario "popping an item empties the stack" do
|
41
41
|
When(:pop_result) { stack.pop }
|
42
42
|
|
43
43
|
Then { pop_result.should == :an_item }
|
@@ -49,14 +49,14 @@ describe Stack do
|
|
49
49
|
Given(:stack) { a_stack_with_several_items }
|
50
50
|
Given!(:original_depth) { stack.depth }
|
51
51
|
|
52
|
-
|
52
|
+
Scenario "pushing a new item adds a new top" do
|
53
53
|
When { stack.push(:new_item) }
|
54
54
|
|
55
55
|
Then { stack.top.should == :new_item }
|
56
56
|
Then { stack.depth.should == original_depth + 1 }
|
57
57
|
end
|
58
58
|
|
59
|
-
|
59
|
+
Scenario "popping an item removes the top item" do
|
60
60
|
When(:pop_result) { stack.pop }
|
61
61
|
|
62
62
|
Then { pop_result.should == :top_item }
|
@@ -2,6 +2,20 @@ module RSpec
|
|
2
2
|
module Given
|
3
3
|
module Extensions
|
4
4
|
|
5
|
+
# Declare a scenario to contain Given/When/Then declarations. A
|
6
|
+
# Scenario is essentially an RSpec context, with the additional
|
7
|
+
# expectations:
|
8
|
+
#
|
9
|
+
# * There is a single When declaration in a Scenario.
|
10
|
+
# * Scenarios do not nest.
|
11
|
+
#
|
12
|
+
# :call-seq:
|
13
|
+
# Scenario "a scenario description" do ... end
|
14
|
+
#
|
15
|
+
def Scenario(description, &block)
|
16
|
+
context(description, &block)
|
17
|
+
end
|
18
|
+
|
5
19
|
# Declare a "given" of the current specification. If the given
|
6
20
|
# is named, the block will be lazily evaluated the first time
|
7
21
|
# the given is mentioned by name in the specification. If the
|
data/lib/rspec/given/version.rb
CHANGED
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
7
|
+
- 3
|
8
8
|
- 0
|
9
|
-
version: 1.
|
9
|
+
version: 1.3.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jim Weirich
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-12-07 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|