rspec-core 2.0.0.beta.15 → 2.0.0.beta.16
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/VERSION +1 -1
- data/features/README.markdown +12 -0
- data/features/command_line/example_name_option.feature +9 -9
- data/features/command_line/line_number_appended_to_path.feature +44 -44
- data/features/command_line/line_number_option.feature +4 -4
- data/features/configuration/custom_settings.feature +3 -3
- data/features/configuration/options_file.feature +3 -3
- data/features/example_groups/describe_aliases.feature +1 -1
- data/features/example_groups/nested_groups.feature +7 -7
- data/features/filtering/inclusion_filters.feature +10 -10
- data/features/formatters/custom_formatter.feature +1 -1
- data/features/hooks/around_hooks.feature +13 -13
- data/features/hooks/before_and_after_hooks.feature +38 -16
- data/features/hooks/described_class.feature +1 -1
- data/features/hooks/halt.feature +1 -1
- data/features/mock_framework_integration/use_flexmock.feature +1 -1
- data/features/mock_framework_integration/use_mocha.feature +1 -1
- data/features/mock_framework_integration/use_rr.feature +1 -1
- data/features/mock_framework_integration/use_rspec.feature +1 -1
- data/features/pending/pending_examples.feature +13 -13
- data/features/subject/explicit_subject.feature +4 -4
- data/features/subject/implicit_subject.feature +2 -2
- data/lib/rspec/core/backward_compatibility.rb +0 -6
- data/lib/rspec/core/command_line.rb +16 -27
- data/lib/rspec/core/configuration.rb +13 -4
- data/lib/rspec/core/example.rb +3 -2
- data/lib/rspec/core/formatters.rb +2 -11
- data/lib/rspec/core/formatters/base_formatter.rb +7 -3
- data/lib/rspec/core/formatters/base_text_formatter.rb +4 -0
- data/lib/rspec/core/formatters/html_formatter.rb +350 -0
- data/lib/rspec/core/formatters/snippet_extractor.rb +52 -0
- data/lib/rspec/core/formatters/text_mate_formatter.rb +18 -0
- data/lib/rspec/core/mocking/with_rspec.rb +6 -6
- data/lib/rspec/core/option_parser.rb +2 -0
- data/lib/rspec/core/runner.rb +11 -11
- data/lib/rspec/core/world.rb +10 -13
- data/rspec-core.gemspec +26 -10
- data/spec/rspec/core/command_line_spec.rb +1 -9
- data/spec/rspec/core/configuration_spec.rb +31 -15
- data/spec/rspec/core/drb_command_line_spec.rb +42 -34
- data/spec/rspec/core/formatters/html_formatted-1.8.7.html +280 -0
- data/spec/rspec/core/formatters/html_formatted-1.9.1.html +260 -0
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +260 -0
- data/spec/rspec/core/formatters/html_formatter_spec.rb +71 -0
- data/spec/rspec/core/formatters/snippet_extractor_spec.rb +18 -0
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +280 -0
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +67 -0
- data/spec/rspec/core/resources/formatter_specs.rb +36 -0
- data/spec/rspec/core/shared_example_group_spec.rb +12 -12
- data/spec/spec_helper.rb +26 -21
- metadata +28 -12
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0.beta.
|
1
|
+
2.0.0.beta.16
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Cucumber features
|
2
|
+
|
3
|
+
RSpec is specified using both RSpec and
|
4
|
+
[Cucumber](http://github.com/aslakhellesoy/cucumber). Cucumber provides
|
5
|
+
_executable documentation_. This means that the _.feature_ files below this
|
6
|
+
directory serve as specification, documentation _and_ regression tests of the
|
7
|
+
behaviour.
|
8
|
+
|
9
|
+
## Issues
|
10
|
+
|
11
|
+
If you find this documentation incomplete or confusing, please [submit an
|
12
|
+
issue](http://github.com/rspec/rspec-core/issues).
|
@@ -37,36 +37,36 @@ Feature: example name option
|
|
37
37
|
|
38
38
|
Scenario: no matches
|
39
39
|
When I run "rspec . --example nothing_like_this"
|
40
|
-
Then
|
40
|
+
Then the output should contain "0 examples, 0 failures"
|
41
41
|
|
42
42
|
Scenario: match on one word
|
43
43
|
When I run "rspec . --example example"
|
44
|
-
Then
|
44
|
+
Then the output should contain "7 examples, 0 failures"
|
45
45
|
|
46
46
|
Scenario: one match in each context
|
47
47
|
When I run "rspec . --example 'first example'"
|
48
|
-
Then
|
48
|
+
Then the output should contain "4 examples, 0 failures"
|
49
49
|
|
50
50
|
Scenario: one match in one file using just the example name
|
51
51
|
When I run "rspec . --example 'first example in first group'"
|
52
|
-
Then
|
52
|
+
Then the output should contain "1 example, 0 failures"
|
53
53
|
|
54
54
|
Scenario: one match in one file using the example name and the group name
|
55
55
|
When I run "rspec . --example 'first group first example in first group'"
|
56
|
-
Then
|
56
|
+
Then the output should contain "1 example, 0 failures"
|
57
57
|
|
58
58
|
Scenario: one match in one file using regexp
|
59
59
|
When I run "rspec . --example 'first .* first example'"
|
60
|
-
Then
|
60
|
+
Then the output should contain "1 example, 0 failures"
|
61
61
|
|
62
62
|
Scenario: all examples in one group
|
63
63
|
When I run "rspec . --example 'first group'"
|
64
|
-
Then
|
64
|
+
Then the output should contain "2 examples, 0 failures"
|
65
65
|
|
66
66
|
Scenario: one match in one file with group name
|
67
67
|
When I run "rspec . --example 'second group first example'"
|
68
|
-
Then
|
68
|
+
Then the output should contain "1 example, 0 failures"
|
69
69
|
|
70
70
|
Scenario: all examples in one group including examples in nested groups
|
71
71
|
When I run "rspec . --example 'third group'"
|
72
|
-
Then
|
72
|
+
Then the output should contain "3 examples, 0 failures"
|
@@ -30,79 +30,79 @@ Feature: line number appended to file path
|
|
30
30
|
|
31
31
|
Scenario: nested groups - outer group on declaration line
|
32
32
|
When I run "rspec ./example_spec.rb:1 --format doc"
|
33
|
-
Then
|
34
|
-
And
|
35
|
-
And
|
36
|
-
And
|
33
|
+
Then the output should contain "3 examples, 0 failures"
|
34
|
+
And the output should contain "second example in outer group"
|
35
|
+
And the output should contain "first example in outer group"
|
36
|
+
And the output should contain "example in nested group"
|
37
37
|
|
38
38
|
Scenario: nested groups - outer group inside block before example
|
39
39
|
When I run "rspec ./example_spec.rb:2 --format doc"
|
40
|
-
Then
|
41
|
-
And
|
42
|
-
And
|
43
|
-
And
|
40
|
+
Then the output should contain "3 examples, 0 failures"
|
41
|
+
And the output should contain "second example in outer group"
|
42
|
+
And the output should contain "first example in outer group"
|
43
|
+
And the output should contain "example in nested group"
|
44
44
|
|
45
45
|
Scenario: nested groups - inner group on declaration line
|
46
46
|
When I run "rspec ./example_spec.rb:11 --format doc"
|
47
|
-
Then
|
48
|
-
And
|
49
|
-
And
|
50
|
-
And
|
47
|
+
Then the output should contain "1 example, 0 failures"
|
48
|
+
And the output should contain "example in nested group"
|
49
|
+
And the output should not contain "second example in outer group"
|
50
|
+
And the output should not contain "first example in outer group"
|
51
51
|
|
52
52
|
Scenario: nested groups - inner group inside block before example
|
53
53
|
When I run "rspec ./example_spec.rb:12 --format doc"
|
54
|
-
Then
|
55
|
-
And
|
56
|
-
And
|
57
|
-
And
|
54
|
+
Then the output should contain "1 example, 0 failures"
|
55
|
+
And the output should contain "example in nested group"
|
56
|
+
And the output should not contain "second example in outer group"
|
57
|
+
And the output should not contain "first example in outer group"
|
58
58
|
|
59
59
|
Scenario: two examples - first example on declaration line
|
60
60
|
When I run "rspec ./example_spec.rb:3 --format doc"
|
61
|
-
Then
|
62
|
-
And
|
63
|
-
But
|
64
|
-
And
|
61
|
+
Then the output should contain "1 example, 0 failures"
|
62
|
+
And the output should contain "first example in outer group"
|
63
|
+
But the output should not contain "second example in outer group"
|
64
|
+
And the output should not contain "example in nested group"
|
65
65
|
|
66
66
|
Scenario: two examples - first example inside block
|
67
67
|
When I run "rspec ./example_spec.rb:4 --format doc"
|
68
|
-
Then
|
69
|
-
And
|
70
|
-
But
|
71
|
-
And
|
68
|
+
Then the output should contain "1 example, 0 failures"
|
69
|
+
And the output should contain "first example in outer group"
|
70
|
+
But the output should not contain "second example in outer group"
|
71
|
+
And the output should not contain "example in nested group"
|
72
72
|
|
73
73
|
Scenario: two examples - first example on end
|
74
74
|
When I run "rspec ./example_spec.rb:5 --format doc"
|
75
|
-
Then
|
76
|
-
And
|
77
|
-
But
|
78
|
-
And
|
75
|
+
Then the output should contain "1 example, 0 failures"
|
76
|
+
And the output should contain "first example in outer group"
|
77
|
+
But the output should not contain "second example in outer group"
|
78
|
+
And the output should not contain "example in nested group"
|
79
79
|
|
80
80
|
Scenario: two examples - first example after end but before next example
|
81
81
|
When I run "rspec ./example_spec.rb:6 --format doc"
|
82
|
-
Then
|
83
|
-
And
|
84
|
-
But
|
85
|
-
And
|
82
|
+
Then the output should contain "1 example, 0 failures"
|
83
|
+
And the output should contain "first example in outer group"
|
84
|
+
But the output should not contain "second example in outer group"
|
85
|
+
And the output should not contain "example in nested group"
|
86
86
|
|
87
87
|
Scenario: two examples - second example on declaration line
|
88
88
|
When I run "rspec ./example_spec.rb:7 --format doc"
|
89
|
-
Then
|
90
|
-
And
|
91
|
-
But
|
92
|
-
And
|
89
|
+
Then the output should contain "1 example, 0 failures"
|
90
|
+
And the output should contain "second example in outer group"
|
91
|
+
But the output should not contain "first example in outer group"
|
92
|
+
And the output should not contain "example in nested group"
|
93
93
|
|
94
94
|
Scenario: two examples - second example inside block
|
95
95
|
When I run "rspec ./example_spec.rb:7 --format doc"
|
96
|
-
Then
|
97
|
-
And
|
98
|
-
But
|
99
|
-
And
|
96
|
+
Then the output should contain "1 example, 0 failures"
|
97
|
+
And the output should contain "second example in outer group"
|
98
|
+
But the output should not contain "first example in outer group"
|
99
|
+
And the output should not contain "example in nested group"
|
100
100
|
|
101
101
|
Scenario: two examples - second example on end
|
102
102
|
When I run "rspec ./example_spec.rb:7 --format doc"
|
103
|
-
Then
|
104
|
-
And
|
105
|
-
But
|
106
|
-
And
|
103
|
+
Then the output should contain "1 example, 0 failures"
|
104
|
+
And the output should contain "second example in outer group"
|
105
|
+
But the output should not contain "first example in outer group"
|
106
|
+
And the output should not contain "example in nested group"
|
107
107
|
|
108
108
|
|
@@ -21,8 +21,8 @@ Feature: line number option
|
|
21
21
|
end
|
22
22
|
"""
|
23
23
|
When I run "rspec ./example_spec.rb --line 5 --format doc"
|
24
|
-
Then
|
25
|
-
Then
|
24
|
+
Then the output should contain "1 example, 0 failures"
|
25
|
+
Then the output should contain "should be > 8"
|
26
26
|
But the stdout should not contain "should be < 10"
|
27
27
|
|
28
28
|
Scenario: one liner
|
@@ -39,6 +39,6 @@ Feature: line number option
|
|
39
39
|
end
|
40
40
|
"""
|
41
41
|
When I run "rspec ./example_spec.rb --line 5 --format doc"
|
42
|
-
Then
|
43
|
-
Then
|
42
|
+
Then the output should contain "1 example, 0 failures"
|
43
|
+
Then the output should contain "should be > 8"
|
44
44
|
But the stdout should not contain "should be < 10"
|
@@ -32,7 +32,7 @@ Feature: custom settings
|
|
32
32
|
end
|
33
33
|
"""
|
34
34
|
When I run "rspec ./additional_setting_spec.rb"
|
35
|
-
Then
|
35
|
+
Then the output should contain "0 failures"
|
36
36
|
|
37
37
|
Scenario: default to true
|
38
38
|
Given a file named "additional_setting_spec.rb" with:
|
@@ -58,7 +58,7 @@ Feature: custom settings
|
|
58
58
|
end
|
59
59
|
"""
|
60
60
|
When I run "rspec ./additional_setting_spec.rb"
|
61
|
-
Then
|
61
|
+
Then the output should contain "0 failures"
|
62
62
|
|
63
63
|
Scenario: overridden in a subsequent RSpec.configure block
|
64
64
|
Given a file named "additional_setting_spec.rb" with:
|
@@ -82,5 +82,5 @@ Feature: custom settings
|
|
82
82
|
end
|
83
83
|
"""
|
84
84
|
When I run "rspec ./additional_setting_spec.rb"
|
85
|
-
Then
|
85
|
+
Then the output should contain "0 failures"
|
86
86
|
|
@@ -21,7 +21,7 @@ Feature: spec/spec.opts
|
|
21
21
|
end
|
22
22
|
"""
|
23
23
|
When I run "rspec ./spec/example_spec.rb"
|
24
|
-
Then
|
24
|
+
Then the output should contain "1 example, 0 failures"
|
25
25
|
|
26
26
|
Scenario: color set in .rspec
|
27
27
|
Given a file named ".rspec" with:
|
@@ -39,7 +39,7 @@ Feature: spec/spec.opts
|
|
39
39
|
end
|
40
40
|
"""
|
41
41
|
When I run "rspec ./spec/example_spec.rb"
|
42
|
-
Then
|
42
|
+
Then the output should contain "1 example, 0 failures"
|
43
43
|
|
44
44
|
Scenario: formatter set in both (RSpec.configure wins)
|
45
45
|
Given a file named ".rspec" with:
|
@@ -63,5 +63,5 @@ Feature: spec/spec.opts
|
|
63
63
|
end
|
64
64
|
"""
|
65
65
|
When I run "rspec ./spec/example_spec.rb"
|
66
|
-
Then
|
66
|
+
Then the output should contain "1 example, 0 failures"
|
67
67
|
|
@@ -20,10 +20,10 @@ Feature: Nested example groups
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
"""
|
23
|
-
When I run "rspec
|
24
|
-
Then
|
25
|
-
And
|
26
|
-
And
|
23
|
+
When I run "rspec nested_example_groups.rb -fdoc"
|
24
|
+
Then the output should contain "Some Object"
|
25
|
+
And the output should contain "with some more context"
|
26
|
+
And the output should contain "with some other context"
|
27
27
|
|
28
28
|
Scenario: failure in outer group continues to run inner groups
|
29
29
|
Given a file named "nested_example_groups.rb" with:
|
@@ -39,6 +39,6 @@ Feature: Nested example groups
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
"""
|
42
|
-
When I run "rspec
|
43
|
-
Then
|
44
|
-
And
|
42
|
+
When I run "rspec nested_example_groups.rb -fdoc"
|
43
|
+
Then the output should contain "2 examples, 1 failure"
|
44
|
+
And the output should contain "passes"
|
@@ -16,8 +16,8 @@ Feature: inclusion feature
|
|
16
16
|
end
|
17
17
|
"""
|
18
18
|
When I run "rspec ./spec/sample_spec.rb --format doc"
|
19
|
-
Then
|
20
|
-
And
|
19
|
+
Then the output should contain "does another thing"
|
20
|
+
And the output should not contain "does one thing"
|
21
21
|
|
22
22
|
Scenario: focus on one group
|
23
23
|
Given a file named "spec/sample_spec.rb" with:
|
@@ -40,9 +40,9 @@ Feature: inclusion feature
|
|
40
40
|
end
|
41
41
|
"""
|
42
42
|
When I run "rspec ./spec/sample_spec.rb --format doc"
|
43
|
-
Then
|
44
|
-
And
|
45
|
-
And
|
43
|
+
Then the output should contain "group 1 example 1"
|
44
|
+
And the output should contain "group 1 example 2"
|
45
|
+
And the output should not contain "group 2 example 1"
|
46
46
|
|
47
47
|
Scenario: no examples match filter
|
48
48
|
Given a file named "spec/sample_spec.rb" with:
|
@@ -66,9 +66,9 @@ Feature: inclusion feature
|
|
66
66
|
end
|
67
67
|
"""
|
68
68
|
When I run "rspec ./spec/sample_spec.rb --format doc"
|
69
|
-
Then
|
70
|
-
And
|
71
|
-
And
|
72
|
-
And
|
73
|
-
And
|
69
|
+
Then the output should contain "No examples were matched by {:focus=>true}, running all"
|
70
|
+
And the output should contain "group 1 example 1"
|
71
|
+
And the output should contain "group 1 example 2"
|
72
|
+
And the output should contain "group 2 example 1"
|
73
|
+
And the output should contain "3 examples, 0 failures"
|
74
74
|
|
@@ -28,5 +28,5 @@ Feature: custom formatters
|
|
28
28
|
"""
|
29
29
|
|
30
30
|
When I run "rspec ./simple_example_spec.rb --require custom_formatter.rb --format CustomFormatter"
|
31
|
-
Then
|
31
|
+
Then the output should contain "example: my example"
|
32
32
|
And the exit status should be 0
|
@@ -20,7 +20,7 @@ Feature: around hooks
|
|
20
20
|
end
|
21
21
|
"""
|
22
22
|
When I run "rspec ./ensure_around_blocks_are_run.rb"
|
23
|
-
Then
|
23
|
+
Then the output should contain:
|
24
24
|
"""
|
25
25
|
around each before
|
26
26
|
in the example
|
@@ -45,7 +45,7 @@ Feature: around hooks
|
|
45
45
|
end
|
46
46
|
"""
|
47
47
|
When I run "rspec ./ensure_around_blocks_are_run.rb"
|
48
|
-
Then
|
48
|
+
Then the output should contain:
|
49
49
|
"""
|
50
50
|
around each before
|
51
51
|
in the example
|
@@ -76,7 +76,7 @@ Feature: around hooks
|
|
76
76
|
end
|
77
77
|
"""
|
78
78
|
When I run "rspec ./ensure_around_blocks_are_run.rb"
|
79
|
-
Then
|
79
|
+
Then the output should contain:
|
80
80
|
"""
|
81
81
|
around each before
|
82
82
|
before each
|
@@ -109,7 +109,7 @@ Feature: around hooks
|
|
109
109
|
end
|
110
110
|
"""
|
111
111
|
When I run "rspec ./ensure_around_blocks_are_run.rb"
|
112
|
-
Then
|
112
|
+
Then the output should contain:
|
113
113
|
"""
|
114
114
|
before all
|
115
115
|
around each before
|
@@ -140,7 +140,7 @@ Feature: around hooks
|
|
140
140
|
end
|
141
141
|
"""
|
142
142
|
When I run "rspec ./around_block_with_context.rb"
|
143
|
-
Then
|
143
|
+
Then the output should contain "1 example, 0 failure"
|
144
144
|
|
145
145
|
Scenario: implicitly pending examples should be detected as Not Yet Implemented
|
146
146
|
Given a file named "around_block_with_implicit_pending_example.rb" with:
|
@@ -154,8 +154,8 @@ Feature: around hooks
|
|
154
154
|
end
|
155
155
|
"""
|
156
156
|
When I run "rspec ./around_block_with_implicit_pending_example.rb"
|
157
|
-
Then
|
158
|
-
And
|
157
|
+
Then the output should contain "1 example, 0 failures, 1 pending"
|
158
|
+
And the output should contain "implicit pending example should be detected as Not Yet Implemented (Not Yet Implemented)"
|
159
159
|
|
160
160
|
|
161
161
|
Scenario: explicitly pending examples should be detected as pending
|
@@ -172,8 +172,8 @@ Feature: around hooks
|
|
172
172
|
end
|
173
173
|
"""
|
174
174
|
When I run "rspec ./around_block_with_explicit_pending_example.rb"
|
175
|
-
Then
|
176
|
-
And
|
175
|
+
Then the output should contain "1 example, 0 failures, 1 pending"
|
176
|
+
And the output should contain "explicit pending example should be detected as pending (No reason given)"
|
177
177
|
|
178
178
|
Scenario: multiple around hooks in the same scope are all run
|
179
179
|
Given a file named "around_hooks_in_same_scope.rb" with:
|
@@ -198,8 +198,8 @@ Feature: around hooks
|
|
198
198
|
end
|
199
199
|
"""
|
200
200
|
When I run "rspec ./around_hooks_in_same_scope.rb"
|
201
|
-
Then
|
202
|
-
And
|
201
|
+
Then the output should contain "1 example, 0 failure"
|
202
|
+
And the output should contain:
|
203
203
|
"""
|
204
204
|
first around hook before
|
205
205
|
second around hook before
|
@@ -258,8 +258,8 @@ Feature: around hooks
|
|
258
258
|
end
|
259
259
|
"""
|
260
260
|
When I run "rspec ./around_hooks_in_outer_scope.rb"
|
261
|
-
Then
|
262
|
-
And
|
261
|
+
Then the output should contain "1 example, 0 failure"
|
262
|
+
And the output should contain:
|
263
263
|
"""
|
264
264
|
first outermost around hook before
|
265
265
|
second outermost around hook before
|
@@ -58,7 +58,7 @@ Feature: before and after hooks
|
|
58
58
|
end
|
59
59
|
"""
|
60
60
|
When I run "rspec ./before_each_spec.rb"
|
61
|
-
Then
|
61
|
+
Then the output should contain "3 examples, 0 failures"
|
62
62
|
|
63
63
|
Scenario: define before(:all) block in example group
|
64
64
|
Given a file named "before_all_spec.rb" with:
|
@@ -92,10 +92,10 @@ Feature: before and after hooks
|
|
92
92
|
end
|
93
93
|
"""
|
94
94
|
When I run "rspec ./before_all_spec.rb"
|
95
|
-
Then
|
95
|
+
Then the output should contain "3 examples, 0 failures"
|
96
96
|
|
97
97
|
When I run "rspec ./before_all_spec.rb:15"
|
98
|
-
Then
|
98
|
+
Then the output should contain "1 example, 0 failures"
|
99
99
|
|
100
100
|
Scenario: define before and after blocks in configuration
|
101
101
|
Given a file named "befores_in_configuration_spec.rb" with:
|
@@ -125,7 +125,7 @@ Feature: before and after hooks
|
|
125
125
|
end
|
126
126
|
"""
|
127
127
|
When I run "rspec ./befores_in_configuration_spec.rb"
|
128
|
-
Then
|
128
|
+
Then the output should contain "2 examples, 0 failures"
|
129
129
|
|
130
130
|
Scenario: before/after blocks are run in order
|
131
131
|
Given a file named "ensure_block_order_spec.rb" with:
|
@@ -155,7 +155,13 @@ Feature: before and after hooks
|
|
155
155
|
end
|
156
156
|
"""
|
157
157
|
When I run "rspec ./ensure_block_order_spec.rb"
|
158
|
-
Then
|
158
|
+
Then the output should contain:
|
159
|
+
"""
|
160
|
+
before all
|
161
|
+
before each
|
162
|
+
after each
|
163
|
+
.after all
|
164
|
+
"""
|
159
165
|
|
160
166
|
Scenario: before/after blocks defined in config are run in order
|
161
167
|
Given a file named "configuration_spec.rb" with:
|
@@ -194,7 +200,7 @@ Feature: before and after hooks
|
|
194
200
|
end
|
195
201
|
"""
|
196
202
|
When I run "rspec configuration_spec.rb"
|
197
|
-
Then
|
203
|
+
Then the output should contain:
|
198
204
|
"""
|
199
205
|
before suite
|
200
206
|
before all
|
@@ -235,16 +241,32 @@ Feature: before and after hooks
|
|
235
241
|
end
|
236
242
|
"""
|
237
243
|
When I run "rspec ./before_and_after_all_spec.rb"
|
238
|
-
Then
|
239
|
-
|
244
|
+
Then the output should contain "2 examples, 0 failures"
|
245
|
+
And the output should contain:
|
246
|
+
"""
|
247
|
+
outer before all
|
248
|
+
.inner before all
|
249
|
+
.inner after all
|
250
|
+
outer after all
|
251
|
+
"""
|
240
252
|
|
241
253
|
When I run "rspec ./before_and_after_all_spec.rb:14"
|
242
|
-
Then
|
243
|
-
|
254
|
+
Then the output should contain "1 example, 0 failures"
|
255
|
+
And the output should contain:
|
256
|
+
"""
|
257
|
+
outer before all
|
258
|
+
inner before all
|
259
|
+
.inner after all
|
260
|
+
outer after all
|
261
|
+
"""
|
244
262
|
|
245
263
|
When I run "rspec ./before_and_after_all_spec.rb:6"
|
246
|
-
Then
|
247
|
-
|
264
|
+
Then the output should contain "1 example, 0 failures"
|
265
|
+
And the output should contain:
|
266
|
+
"""
|
267
|
+
outer before all
|
268
|
+
.outer after all
|
269
|
+
"""
|
248
270
|
|
249
271
|
Scenario: nested examples have access to state set in outer before(:all)
|
250
272
|
Given a file named "before_all_spec.rb" with:
|
@@ -274,7 +296,7 @@ Feature: before and after hooks
|
|
274
296
|
end
|
275
297
|
"""
|
276
298
|
When I run "rspec before_all_spec.rb"
|
277
|
-
Then
|
299
|
+
Then the output should contain "3 examples, 0 failures"
|
278
300
|
|
279
301
|
Scenario: before/after all blocks have access to state
|
280
302
|
Given a file named "before_and_after_all_spec.rb" with:
|
@@ -310,7 +332,7 @@ Feature: before and after hooks
|
|
310
332
|
end
|
311
333
|
"""
|
312
334
|
When I run "rspec ./before_and_after_all_spec.rb"
|
313
|
-
Then
|
335
|
+
Then the output should contain "2 examples, 0 failures"
|
314
336
|
|
315
337
|
Scenario: exception in before(:each) is captured and reported as failure
|
316
338
|
Given a file named "error_in_before_each_spec.rb" with:
|
@@ -325,5 +347,5 @@ Feature: before and after hooks
|
|
325
347
|
end
|
326
348
|
"""
|
327
349
|
When I run "rspec ./error_in_before_each_spec.rb"
|
328
|
-
Then
|
329
|
-
And
|
350
|
+
Then the output should contain "1 example, 1 failure"
|
351
|
+
And the output should contain "this error"
|