rspec-core 2.0.0.beta.15 → 2.0.0.beta.16

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.
Files changed (52) hide show
  1. data/Gemfile +2 -0
  2. data/VERSION +1 -1
  3. data/features/README.markdown +12 -0
  4. data/features/command_line/example_name_option.feature +9 -9
  5. data/features/command_line/line_number_appended_to_path.feature +44 -44
  6. data/features/command_line/line_number_option.feature +4 -4
  7. data/features/configuration/custom_settings.feature +3 -3
  8. data/features/configuration/options_file.feature +3 -3
  9. data/features/example_groups/describe_aliases.feature +1 -1
  10. data/features/example_groups/nested_groups.feature +7 -7
  11. data/features/filtering/inclusion_filters.feature +10 -10
  12. data/features/formatters/custom_formatter.feature +1 -1
  13. data/features/hooks/around_hooks.feature +13 -13
  14. data/features/hooks/before_and_after_hooks.feature +38 -16
  15. data/features/hooks/described_class.feature +1 -1
  16. data/features/hooks/halt.feature +1 -1
  17. data/features/mock_framework_integration/use_flexmock.feature +1 -1
  18. data/features/mock_framework_integration/use_mocha.feature +1 -1
  19. data/features/mock_framework_integration/use_rr.feature +1 -1
  20. data/features/mock_framework_integration/use_rspec.feature +1 -1
  21. data/features/pending/pending_examples.feature +13 -13
  22. data/features/subject/explicit_subject.feature +4 -4
  23. data/features/subject/implicit_subject.feature +2 -2
  24. data/lib/rspec/core/backward_compatibility.rb +0 -6
  25. data/lib/rspec/core/command_line.rb +16 -27
  26. data/lib/rspec/core/configuration.rb +13 -4
  27. data/lib/rspec/core/example.rb +3 -2
  28. data/lib/rspec/core/formatters.rb +2 -11
  29. data/lib/rspec/core/formatters/base_formatter.rb +7 -3
  30. data/lib/rspec/core/formatters/base_text_formatter.rb +4 -0
  31. data/lib/rspec/core/formatters/html_formatter.rb +350 -0
  32. data/lib/rspec/core/formatters/snippet_extractor.rb +52 -0
  33. data/lib/rspec/core/formatters/text_mate_formatter.rb +18 -0
  34. data/lib/rspec/core/mocking/with_rspec.rb +6 -6
  35. data/lib/rspec/core/option_parser.rb +2 -0
  36. data/lib/rspec/core/runner.rb +11 -11
  37. data/lib/rspec/core/world.rb +10 -13
  38. data/rspec-core.gemspec +26 -10
  39. data/spec/rspec/core/command_line_spec.rb +1 -9
  40. data/spec/rspec/core/configuration_spec.rb +31 -15
  41. data/spec/rspec/core/drb_command_line_spec.rb +42 -34
  42. data/spec/rspec/core/formatters/html_formatted-1.8.7.html +280 -0
  43. data/spec/rspec/core/formatters/html_formatted-1.9.1.html +260 -0
  44. data/spec/rspec/core/formatters/html_formatted-1.9.2.html +260 -0
  45. data/spec/rspec/core/formatters/html_formatter_spec.rb +71 -0
  46. data/spec/rspec/core/formatters/snippet_extractor_spec.rb +18 -0
  47. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +280 -0
  48. data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +67 -0
  49. data/spec/rspec/core/resources/formatter_specs.rb +36 -0
  50. data/spec/rspec/core/shared_example_group_spec.rb +12 -12
  51. data/spec/spec_helper.rb +26 -21
  52. metadata +28 -12
data/Gemfile CHANGED
@@ -11,6 +11,8 @@ gem "rcov"
11
11
  gem "mocha"
12
12
  gem "rr"
13
13
  gem "flexmock"
14
+ gem "nokogiri"
15
+ gem "syntax"
14
16
  gem "rspec-core", :path => "."
15
17
  gem "rspec-expectations", :path => "../rspec-expectations"
16
18
  gem "rspec-mocks", :path => "../rspec-mocks"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.beta.15
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 I should see "0 examples, 0 failures"
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 I should see "7 examples, 0 failures"
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 I should see "4 examples, 0 failures"
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 I should see "1 example, 0 failures"
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 I should see "1 example, 0 failures"
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 I should see "1 example, 0 failures"
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 I should see "2 examples, 0 failures"
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 I should see "1 example, 0 failures"
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 I should see "3 examples, 0 failures"
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 I should see "3 examples, 0 failures"
34
- And I should see "second example in outer group"
35
- And I should see "first example in outer group"
36
- And I should see "example in nested group"
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 I should see "3 examples, 0 failures"
41
- And I should see "second example in outer group"
42
- And I should see "first example in outer group"
43
- And I should see "example in nested group"
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 I should see "1 example, 0 failures"
48
- And I should see "example in nested group"
49
- And I should not see "second example in outer group"
50
- And I should not see "first example in outer group"
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 I should see "1 example, 0 failures"
55
- And I should see "example in nested group"
56
- And I should not see "second example in outer group"
57
- And I should not see "first example in outer group"
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 I should see "1 example, 0 failures"
62
- And I should see "first example in outer group"
63
- But I should not see "second example in outer group"
64
- And I should not see "example in nested group"
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 I should see "1 example, 0 failures"
69
- And I should see "first example in outer group"
70
- But I should not see "second example in outer group"
71
- And I should not see "example in nested group"
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 I should see "1 example, 0 failures"
76
- And I should see "first example in outer group"
77
- But I should not see "second example in outer group"
78
- And I should not see "example in nested group"
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 I should see "1 example, 0 failures"
83
- And I should see "first example in outer group"
84
- But I should not see "second example in outer group"
85
- And I should not see "example in nested group"
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 I should see "1 example, 0 failures"
90
- And I should see "second example in outer group"
91
- But I should not see "first example in outer group"
92
- And I should not see "example in nested group"
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 I should see "1 example, 0 failures"
97
- And I should see "second example in outer group"
98
- But I should not see "first example in outer group"
99
- And I should not see "example in nested group"
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 I should see "1 example, 0 failures"
104
- And I should see "second example in outer group"
105
- But I should not see "first example in outer group"
106
- And I should not see "example in nested group"
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 I should see "1 example, 0 failures"
25
- Then I should see "should be > 8"
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 I should see "1 example, 0 failures"
43
- Then I should see "should be > 8"
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 I should see "0 failures"
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 I should see "0 failures"
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 I should see "0 failures"
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 I should see "1 example, 0 failures"
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 I should see "1 example, 0 failures"
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 I should see "1 example, 0 failures"
66
+ Then the output should contain "1 example, 0 failures"
67
67
 
@@ -18,7 +18,7 @@ Feature: Nested example groups
18
18
  end
19
19
  """
20
20
  When I run "rspec ./context_instead_of_describe_spec.rb -fn"
21
- Then I should see:
21
+ Then the output should contain:
22
22
  """
23
23
  Using context
24
24
  with nested context
@@ -20,10 +20,10 @@ Feature: Nested example groups
20
20
  end
21
21
  end
22
22
  """
23
- When I run "rspec ./nested_example_groups.rb -fdoc"
24
- Then I should see matching /^Some Object/
25
- And I should see matching /^\s+with some more context/
26
- And I should see matching /^\s+with some other context/
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 ./nested_example_groups.rb -fdoc"
43
- Then I should see "2 examples, 1 failure"
44
- And I should see "passes"
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 I should see "does another thing"
20
- And I should not see "does one thing"
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 I should see "group 1 example 1"
44
- And I should see "group 1 example 2"
45
- And I should not see "group 2 example 1"
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 I should see "No examples were matched by {:focus=>true}, running all"
70
- And I should see "group 1 example 1"
71
- And I should see "group 1 example 2"
72
- And I should see "group 2 example 1"
73
- And I should see "3 examples, 0 failures"
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 I should see "example: my example"
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 I should see matching:
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 I should see matching:
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 I should see matching:
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 I should see matching:
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 I should see "1 example, 0 failure"
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 I should see "1 example, 0 failures, 1 pending"
158
- And I should see "implicit pending example should be detected as Not Yet Implemented (Not Yet Implemented)"
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 I should see "1 example, 0 failures, 1 pending"
176
- And I should see "explicit pending example should be detected as pending (No reason given)"
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 I should see "1 example, 0 failure"
202
- And I should see matching:
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 I should see "1 example, 0 failure"
262
- And I should see matching:
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 I should see "3 examples, 0 failures"
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 I should see "3 examples, 0 failures"
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 I should see "1 example, 0 failures"
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 I should see "2 examples, 0 failures"
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 I should see matching /before all\nbefore each\nafter each\n.after all/
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 I should see matching:
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 I should see "2 examples, 0 failures"
239
- Then I should see matching /outer before all\n.inner before all\n.inner after all\nouter after all\n\n\n\nFinished/
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 I should see "1 example, 0 failures"
243
- Then I should see matching /outer before all\ninner before all\n.inner after all\nouter after all\n\n\n\nFinished/
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 I should see "1 example, 0 failures"
247
- Then I should see matching /outer before all\n.outer after all\n\n\n\nFinished/
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 I should see "3 examples, 0 failures"
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 I should see "2 examples, 0 failures"
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 I should see "1 example, 1 failure"
329
- And I should see "this error"
350
+ Then the output should contain "1 example, 1 failure"
351
+ And the output should contain "this error"