rspec-core 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +8 -3
- data/Guardfile +5 -0
- data/History.markdown +32 -2
- data/README.markdown +10 -3
- data/Rakefile +12 -13
- data/Upgrade.markdown +175 -121
- data/bin/autospec +13 -0
- data/bin/rspec +24 -1
- data/features/command_line/line_number_appended_to_path.feature +3 -1
- data/features/command_line/line_number_option.feature +3 -1
- data/features/command_line/tag.feature +74 -0
- data/features/filtering/exclusion_filters.feature +1 -1
- data/features/filtering/implicit_filters.feature +166 -0
- data/features/hooks/around_hooks.feature +51 -44
- data/features/metadata/described_class.feature +3 -0
- data/features/pending/pending_examples.feature +76 -0
- data/features/step_definitions/additional_cli_steps.rb +11 -0
- data/features/subject/attribute_of_subject.feature +8 -0
- data/features/subject/explicit_subject.feature +8 -13
- data/features/subject/implicit_receiver.feature +29 -0
- data/features/subject/implicit_subject.feature +6 -7
- data/lib/rspec/core.rb +3 -21
- data/lib/rspec/core/backward_compatibility.rb +22 -3
- data/lib/rspec/core/command_line.rb +1 -0
- data/lib/rspec/core/configuration.rb +34 -6
- data/lib/rspec/core/configuration_options.rb +1 -3
- data/lib/rspec/core/example.rb +0 -5
- data/lib/rspec/core/example_group.rb +9 -8
- data/lib/rspec/core/expecting/with_rspec.rb +11 -0
- data/lib/rspec/core/extensions/object.rb +1 -1
- data/lib/rspec/core/formatters/base_formatter.rb +1 -6
- data/lib/rspec/core/hooks.rb +1 -1
- data/lib/rspec/core/metadata.rb +15 -5
- data/lib/rspec/core/option_parser.rb +17 -0
- data/lib/rspec/core/pending.rb +10 -1
- data/lib/rspec/core/rake_task.rb +32 -10
- data/lib/rspec/core/reporter.rb +1 -0
- data/lib/rspec/core/subject.rb +58 -59
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +9 -4
- data/rspec-core.gemspec +4 -11
- data/spec/rspec/core/command_line_spec.rb +16 -5
- data/spec/rspec/core/configuration_options_spec.rb +6 -0
- data/spec/rspec/core/configuration_spec.rb +89 -6
- data/spec/rspec/core/deprecations_spec.rb +17 -1
- data/spec/rspec/core/example_group_spec.rb +29 -14
- data/spec/rspec/core/example_spec.rb +0 -7
- data/spec/rspec/core/formatters/html_formatted-1.8.6.html +49 -33
- data/spec/rspec/core/formatters/html_formatted-1.8.7.html +5 -5
- data/spec/rspec/core/formatters/html_formatted-1.9.1.html +46 -26
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +5 -5
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.6.html +49 -33
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +19 -19
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.1.html +56 -33
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +26 -38
- data/spec/rspec/core/metadata_spec.rb +153 -132
- data/spec/rspec/core/pending_example_spec.rb +133 -25
- data/spec/rspec/core/rake_task_spec.rb +25 -32
- data/spec/rspec/core/subject_spec.rb +15 -0
- data/spec/rspec/core/world_spec.rb +72 -61
- data/spec/spec_helper.rb +0 -14
- metadata +25 -135
- data/features/hooks/halt.feature +0 -26
data/bin/autospec
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rspec/core/deprecation'
|
3
|
+
RSpec.warn_deprecation <<-WARNING
|
4
|
+
************************************************************
|
5
|
+
REMOVAL NOTICE: you are using behaviour that has been
|
6
|
+
removed from rspec-2.
|
7
|
+
|
8
|
+
* The 'autospec' command is no longer supported.
|
9
|
+
* Please use 'autotest' insted.
|
10
|
+
|
11
|
+
This message will be removed from a future version of rspec.
|
12
|
+
************************************************************
|
13
|
+
WARNING
|
data/bin/rspec
CHANGED
@@ -1,2 +1,25 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rspec/autorun'
|
5
|
+
rescue LoadError
|
6
|
+
$stderr.puts <<-EOS
|
7
|
+
#{'*'*50}
|
8
|
+
Could not find 'rspec/autorun'
|
9
|
+
|
10
|
+
This may happen if you're using rubygems as your package manager, but it is not
|
11
|
+
being required through some mechanism before executing the rspec command.
|
12
|
+
|
13
|
+
You may need to do one of the following in your shell:
|
14
|
+
|
15
|
+
# for bash/zsh
|
16
|
+
export RUBYOPT=rubygems
|
17
|
+
|
18
|
+
# for csh, etc.
|
19
|
+
set RUBYOPT=rubygems
|
20
|
+
|
21
|
+
For background, please see http://gist.github.com/54177.
|
22
|
+
#{'*'*50}
|
23
|
+
EOS
|
24
|
+
exit(1)
|
25
|
+
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
Feature: line number appended to file path
|
2
2
|
|
3
|
-
|
3
|
+
To run a single example or group, you can append the line number to the path, e.g.
|
4
|
+
|
5
|
+
rspec path/to/example_spec.rb:37
|
4
6
|
|
5
7
|
Background:
|
6
8
|
Given a file named "example_spec.rb" with:
|
@@ -1,6 +1,8 @@
|
|
1
1
|
Feature: line number option
|
2
2
|
|
3
|
-
|
3
|
+
To run a single example or group, you can use the --line option:
|
4
|
+
|
5
|
+
rspec path/to/example_spec.rb --line 37
|
4
6
|
|
5
7
|
Scenario: standard examples
|
6
8
|
Given a file named "example_spec.rb" with:
|
@@ -0,0 +1,74 @@
|
|
1
|
+
Feature: tag option
|
2
|
+
|
3
|
+
Use the --tag (or -t) option to filter the examples to be run by tag.
|
4
|
+
|
5
|
+
The tag can be a simple name or a name:value pair. In the first case,
|
6
|
+
examples with :name => true will be filtered. In the second case, examples
|
7
|
+
with :name => value will be filtered, where value is always a string.
|
8
|
+
In both cases, name is converted to a symbol.
|
9
|
+
|
10
|
+
Tags can also be used to exclude examples by adding a ~ before the tag.
|
11
|
+
For example ~tag will exclude all examples marked with :tag => true and
|
12
|
+
~tag:value will exclude all examples marked with :tag => value.
|
13
|
+
|
14
|
+
To be compatible with the Cucumber syntax, tags can optionally start with
|
15
|
+
a @, that will be ignored.
|
16
|
+
|
17
|
+
Background:
|
18
|
+
Given a file named "tagged_spec.rb" with:
|
19
|
+
"""
|
20
|
+
describe "group with tagged specs" do
|
21
|
+
it "example I'm working now", :focus => true do; end
|
22
|
+
it "special example", :type => 'special' do; end
|
23
|
+
it "slow example", :skip => true do; end
|
24
|
+
it "ordinary example", :speed => 'slow' do; end
|
25
|
+
it "untagged example" do; end
|
26
|
+
end
|
27
|
+
"""
|
28
|
+
|
29
|
+
Scenario: filter examples with non-existent tag
|
30
|
+
When I run "rspec . --tag mytag"
|
31
|
+
And the output should contain "0 examples, 0 failures"
|
32
|
+
|
33
|
+
Scenario: filter examples with a simple tag
|
34
|
+
When I run "rspec . --tag focus"
|
35
|
+
Then the output should contain "Run filtered using {:focus=>true}"
|
36
|
+
And the output should contain "1 example, 0 failures"
|
37
|
+
|
38
|
+
Scenario: filter examples with a simple tag and @
|
39
|
+
When I run "rspec . --tag @focus"
|
40
|
+
Then the output should contain "Run filtered using {:focus=>true}"
|
41
|
+
Then the output should contain "1 example, 0 failures"
|
42
|
+
|
43
|
+
Scenario: filter examples with a name:value tag
|
44
|
+
When I run "rspec . --tag type:special"
|
45
|
+
Then the output should contain:
|
46
|
+
"""
|
47
|
+
Run filtered using {:type=>"special"}
|
48
|
+
"""
|
49
|
+
And the output should contain "1 example, 0 failures"
|
50
|
+
|
51
|
+
Scenario: filter examples with a name:value tag and @
|
52
|
+
When I run "rspec . --tag @type:special"
|
53
|
+
Then the output should contain:
|
54
|
+
"""
|
55
|
+
Run filtered using {:type=>"special"}
|
56
|
+
"""
|
57
|
+
And the output should contain "1 example, 0 failures"
|
58
|
+
|
59
|
+
Scenario: exclude examples with a simple tag
|
60
|
+
When I run "rspec . --tag ~skip"
|
61
|
+
Then the output should contain "4 examples, 0 failures"
|
62
|
+
|
63
|
+
Scenario: exclude examples with a simple tag and @
|
64
|
+
When I run "rspec . --tag ~@skip"
|
65
|
+
Then the output should contain "4 examples, 0 failures"
|
66
|
+
|
67
|
+
Scenario: exclude examples with a name:value tag
|
68
|
+
When I run "rspec . --tag ~speed:slow"
|
69
|
+
Then the output should contain "4 examples, 0 failures"
|
70
|
+
|
71
|
+
Scenario: exclude examples with a name:value tag and @
|
72
|
+
When I run "rspec . --tag ~@speed:slow"
|
73
|
+
Then the output should contain "4 examples, 0 failures"
|
74
|
+
|
@@ -78,7 +78,7 @@ Feature: exclusion filters
|
|
78
78
|
end
|
79
79
|
"""
|
80
80
|
When I run "rspec ./spec/sample_spec.rb --format doc"
|
81
|
-
Then the output should
|
81
|
+
Then the output should match /No examples were matched. Perhaps \{.*:broken=>true.*\} is excluding everything?/
|
82
82
|
And the output should contain "0 examples, 0 failures"
|
83
83
|
And the output should not contain "group 1"
|
84
84
|
And the output should not contain "group 2"
|
@@ -0,0 +1,166 @@
|
|
1
|
+
Feature: implicit filters
|
2
|
+
|
3
|
+
The `:if` and `:unless` metadata keys can be used to filter examples without
|
4
|
+
needing to configure an exclusion filter.
|
5
|
+
|
6
|
+
Scenario: implicit :if filter
|
7
|
+
Given a file named "implicit_if_filter_spec.rb" with:
|
8
|
+
"""
|
9
|
+
describe ":if => true group", :if => true do
|
10
|
+
it(":if => true group :if => true example", :if => true) { }
|
11
|
+
it(":if => true group :if => false example", :if => false) { }
|
12
|
+
it(":if => true group no :if example") { }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe ":if => false group", :if => false do
|
16
|
+
it(":if => false group :if => true example", :if => true) { }
|
17
|
+
it(":if => false group :if => false example", :if => false) { }
|
18
|
+
it(":if => false group no :if example") { }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "no :if group" do
|
22
|
+
it("no :if group :if => true example", :if => true) { }
|
23
|
+
it("no :if group :if => false example", :if => false) { }
|
24
|
+
it("no :if group no :if example") { }
|
25
|
+
end
|
26
|
+
"""
|
27
|
+
When I run "rspec implicit_if_filter_spec.rb --format doc"
|
28
|
+
Then the output should contain all of these:
|
29
|
+
| :if => true group :if => true example |
|
30
|
+
| :if => true group no :if example |
|
31
|
+
| :if => false group :if => true example |
|
32
|
+
| no :if group :if => true example |
|
33
|
+
| no :if group no :if example |
|
34
|
+
And the output should not contain any of these:
|
35
|
+
| :if => true group :if => false example |
|
36
|
+
| :if => false group :if => false example |
|
37
|
+
| :if => false group no :if example |
|
38
|
+
| no :if group :if => false example |
|
39
|
+
|
40
|
+
Scenario: implicit :unless filter
|
41
|
+
Given a file named "implicit_unless_filter_spec.rb" with:
|
42
|
+
"""
|
43
|
+
describe ":unless => true group", :unless => true do
|
44
|
+
it(":unless => true group :unless => true example", :unless => true) { }
|
45
|
+
it(":unless => true group :unless => false example", :unless => false) { }
|
46
|
+
it(":unless => true group no :unless example") { }
|
47
|
+
end
|
48
|
+
|
49
|
+
describe ":unless => false group", :unless => false do
|
50
|
+
it(":unless => false group :unless => true example", :unless => true) { }
|
51
|
+
it(":unless => false group :unless => false example", :unless => false) { }
|
52
|
+
it(":unless => false group no :unless example") { }
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "no :unless group" do
|
56
|
+
it("no :unless group :unless => true example", :unless => true) { }
|
57
|
+
it("no :unless group :unless => false example", :unless => false) { }
|
58
|
+
it("no :unless group no :unless example") { }
|
59
|
+
end
|
60
|
+
"""
|
61
|
+
When I run "rspec implicit_unless_filter_spec.rb --format doc"
|
62
|
+
Then the output should contain all of these:
|
63
|
+
| :unless => true group :unless => false example |
|
64
|
+
| :unless => false group :unless => false example |
|
65
|
+
| :unless => false group no :unless example |
|
66
|
+
| no :unless group :unless => false example |
|
67
|
+
| no :unless group no :unless example |
|
68
|
+
And the output should not contain any of these:
|
69
|
+
| :unless => true group :unless => true example |
|
70
|
+
| :unless => true group no :unless example |
|
71
|
+
| :unless => false group :unless => true example |
|
72
|
+
| no :unless group :unless => true example |
|
73
|
+
|
74
|
+
Scenario: combining implicit filter with explicit inclusion filter
|
75
|
+
Given a file named "explicit_inclusion_filter_spec.rb" with:
|
76
|
+
"""
|
77
|
+
RSpec.configure do |c|
|
78
|
+
c.filter_run :focus => true
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "group with :focus", :focus => true do
|
82
|
+
it("focused example") { }
|
83
|
+
it("focused :if => true example", :if => true) { }
|
84
|
+
it("focused :if => false example", :if => false) { }
|
85
|
+
it("focused :unless => true example", :unless => true) { }
|
86
|
+
it("focused :unless => false example", :unless => false) { }
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "group without :focus" do
|
90
|
+
it("unfocused example") { }
|
91
|
+
it("unfocused :if => true example", :if => true) { }
|
92
|
+
it("unfocused :if => false example", :if => false) { }
|
93
|
+
it("unfocused :unless => true example", :unless => true) { }
|
94
|
+
it("unfocused :unless => false example", :unless => false) { }
|
95
|
+
end
|
96
|
+
"""
|
97
|
+
When I run "rspec explicit_inclusion_filter_spec.rb --format doc"
|
98
|
+
Then the output should contain all of these:
|
99
|
+
| focused example |
|
100
|
+
| focused :if => true example |
|
101
|
+
| focused :unless => false example |
|
102
|
+
And the output should not contain any of these:
|
103
|
+
| focused :if => false example |
|
104
|
+
| focused :unless => true example |
|
105
|
+
| unfocused |
|
106
|
+
|
107
|
+
Scenario: combining implicit filter with explicit exclusion filter
|
108
|
+
Given a file named "explicit_exclusion_filter_spec.rb" with:
|
109
|
+
"""
|
110
|
+
RSpec.configure do |c|
|
111
|
+
c.filter_run_excluding :broken => true
|
112
|
+
end
|
113
|
+
|
114
|
+
describe "unbroken group" do
|
115
|
+
it("included example") { }
|
116
|
+
it("included :if => true example", :if => true) { }
|
117
|
+
it("included :if => false example", :if => false) { }
|
118
|
+
it("included :unless => true example", :unless => true) { }
|
119
|
+
it("included :unless => false example", :unless => false) { }
|
120
|
+
end
|
121
|
+
|
122
|
+
describe "broken group", :broken => true do
|
123
|
+
it("excluded example") { }
|
124
|
+
it("excluded :if => true example", :if => true) { }
|
125
|
+
it("excluded :if => false example", :if => false) { }
|
126
|
+
it("excluded :unless => true example", :unless => true) { }
|
127
|
+
it("excluded :unless => false example", :unless => false) { }
|
128
|
+
end
|
129
|
+
"""
|
130
|
+
When I run "rspec explicit_exclusion_filter_spec.rb --format doc"
|
131
|
+
Then the output should contain all of these:
|
132
|
+
| included example |
|
133
|
+
| included :if => true example |
|
134
|
+
| included :unless => false example |
|
135
|
+
And the output should not contain any of these:
|
136
|
+
| included :if => false example |
|
137
|
+
| included :unless => true example |
|
138
|
+
| excluded |
|
139
|
+
|
140
|
+
Scenario: override implicit :if and :unless exclusion filters
|
141
|
+
Given a file named "override_implicit_filters_spec.rb" with:
|
142
|
+
"""
|
143
|
+
RSpec.configure do |c|
|
144
|
+
c.filter_run_excluding :if => :exclude_me, :unless => :exclude_me_for_unless
|
145
|
+
end
|
146
|
+
|
147
|
+
describe ":if filtering" do
|
148
|
+
it(":if => true example", :if => true) { }
|
149
|
+
it(":if => false example", :if => false) { }
|
150
|
+
it(":if => :exclude_me example", :if => :exclude_me) { }
|
151
|
+
end
|
152
|
+
|
153
|
+
describe ":unless filtering" do
|
154
|
+
it(":unless => true example", :unless => true) { }
|
155
|
+
it(":unless => false example", :unless => false) { }
|
156
|
+
it(":unless => :exclude_me_for_unless example", :unless => :exclude_me_for_unless) { }
|
157
|
+
end
|
158
|
+
"""
|
159
|
+
When I run "rspec override_implicit_filters_spec.rb --format doc"
|
160
|
+
Then the output should contain all of these:
|
161
|
+
| :if => true example |
|
162
|
+
| :if => false example |
|
163
|
+
| :unless => true example |
|
164
|
+
| :unless => false example |
|
165
|
+
And the output should not contain "exclude_me"
|
166
|
+
|
@@ -1,52 +1,59 @@
|
|
1
1
|
Feature: around hooks
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
Around hooks receive the example as a block argument, extended to behave like
|
4
|
+
a proc. This lets you define code that should be executed before and after
|
5
|
+
the example. Of course, you can do the same thing with before and after hooks,
|
6
|
+
and it's often cleaner to do so.
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
Where around hooks shine is when you want to run an example in a block. For
|
9
|
+
example, if your database library offers a transaction method that receives
|
10
|
+
a block, you can use an around hook as described in the first scenario:
|
11
|
+
|
12
|
+
Scenario: use the example as a block within the block passed to around()
|
13
|
+
Given a file named "example_spec.rb" with:
|
9
14
|
"""
|
15
|
+
class Database
|
16
|
+
def self.transaction
|
17
|
+
puts "open transaction"
|
18
|
+
yield
|
19
|
+
puts "close transaction"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
10
23
|
describe "around filter" do
|
11
24
|
around(:each) do |example|
|
12
|
-
|
13
|
-
example.run
|
14
|
-
puts "around each after"
|
25
|
+
Database.transaction(&example)
|
15
26
|
end
|
16
27
|
|
17
28
|
it "gets run in order" do
|
18
|
-
puts "
|
29
|
+
puts "run the example"
|
19
30
|
end
|
20
31
|
end
|
21
32
|
"""
|
22
|
-
When I run "rspec
|
33
|
+
When I run "rspec example_spec.rb"
|
23
34
|
Then the output should contain:
|
24
35
|
"""
|
25
|
-
|
26
|
-
|
27
|
-
|
36
|
+
open transaction
|
37
|
+
run the example
|
38
|
+
close transaction
|
28
39
|
"""
|
29
40
|
|
30
|
-
Scenario:
|
31
|
-
Given a file named "
|
41
|
+
Scenario: invoke the example using run()
|
42
|
+
Given a file named "example_spec.rb" with:
|
32
43
|
"""
|
33
44
|
describe "around filter" do
|
34
|
-
|
45
|
+
around(:each) do |example|
|
35
46
|
puts "around each before"
|
36
|
-
|
47
|
+
example.run
|
37
48
|
puts "around each after"
|
38
49
|
end
|
39
50
|
|
40
|
-
around(:each) do |example|
|
41
|
-
perform_around(&example)
|
42
|
-
end
|
43
|
-
|
44
51
|
it "gets run in order" do
|
45
52
|
puts "in the example"
|
46
53
|
end
|
47
54
|
end
|
48
55
|
"""
|
49
|
-
When I run "rspec
|
56
|
+
When I run "rspec example_spec.rb"
|
50
57
|
Then the output should contain:
|
51
58
|
"""
|
52
59
|
around each before
|
@@ -54,8 +61,8 @@ Feature: around hooks
|
|
54
61
|
around each after
|
55
62
|
"""
|
56
63
|
|
57
|
-
Scenario:
|
58
|
-
Given a file named "
|
64
|
+
Scenario: define a global around hook
|
65
|
+
Given a file named "example_spec.rb" with:
|
59
66
|
"""
|
60
67
|
RSpec.configure do |c|
|
61
68
|
c.around(:each) do |example|
|
@@ -71,7 +78,7 @@ Feature: around hooks
|
|
71
78
|
end
|
72
79
|
end
|
73
80
|
"""
|
74
|
-
When I run "rspec
|
81
|
+
When I run "rspec example_spec.rb"
|
75
82
|
Then the output should contain:
|
76
83
|
"""
|
77
84
|
around each before
|
@@ -80,7 +87,7 @@ Feature: around hooks
|
|
80
87
|
"""
|
81
88
|
|
82
89
|
Scenario: before/after(:each) hooks are wrapped by the around hook
|
83
|
-
Given a file named "
|
90
|
+
Given a file named "example_spec.rb" with:
|
84
91
|
"""
|
85
92
|
describe "around filter" do
|
86
93
|
around(:each) do |example|
|
@@ -102,7 +109,7 @@ Feature: around hooks
|
|
102
109
|
end
|
103
110
|
end
|
104
111
|
"""
|
105
|
-
When I run "rspec
|
112
|
+
When I run "rspec example_spec.rb"
|
106
113
|
Then the output should contain:
|
107
114
|
"""
|
108
115
|
around each before
|
@@ -113,7 +120,7 @@ Feature: around hooks
|
|
113
120
|
"""
|
114
121
|
|
115
122
|
Scenario: before/after(:all) hooks are NOT wrapped by the around hook
|
116
|
-
Given a file named "
|
123
|
+
Given a file named "example_spec.rb" with:
|
117
124
|
"""
|
118
125
|
describe "around filter" do
|
119
126
|
around(:each) do |example|
|
@@ -135,7 +142,7 @@ Feature: around hooks
|
|
135
142
|
end
|
136
143
|
end
|
137
144
|
"""
|
138
|
-
When I run "rspec
|
145
|
+
When I run "rspec example_spec.rb"
|
139
146
|
Then the output should contain:
|
140
147
|
"""
|
141
148
|
before all
|
@@ -145,8 +152,8 @@ Feature: around hooks
|
|
145
152
|
.after all
|
146
153
|
"""
|
147
154
|
|
148
|
-
Scenario: examples run by an around block
|
149
|
-
Given a file named "
|
155
|
+
Scenario: examples run by an around block are run in the configured context
|
156
|
+
Given a file named "example_spec.rb" with:
|
150
157
|
"""
|
151
158
|
module IncludedInConfigureBlock
|
152
159
|
def included_in_configure_block; true; end
|
@@ -166,11 +173,11 @@ Feature: around hooks
|
|
166
173
|
end
|
167
174
|
end
|
168
175
|
"""
|
169
|
-
When I run "rspec
|
176
|
+
When I run "rspec example_spec.rb"
|
170
177
|
Then the output should contain "1 example, 0 failure"
|
171
178
|
|
172
|
-
Scenario: implicitly pending examples
|
173
|
-
Given a file named "
|
179
|
+
Scenario: implicitly pending examples are detected as Not Yet Implemented
|
180
|
+
Given a file named "example_spec.rb" with:
|
174
181
|
"""
|
175
182
|
describe "implicit pending example" do
|
176
183
|
around(:each) do |example|
|
@@ -180,7 +187,7 @@ Feature: around hooks
|
|
180
187
|
it "should be detected as Not Yet Implemented"
|
181
188
|
end
|
182
189
|
"""
|
183
|
-
When I run "rspec
|
190
|
+
When I run "rspec example_spec.rb"
|
184
191
|
Then the output should contain "1 example, 0 failures, 1 pending"
|
185
192
|
And the output should contain:
|
186
193
|
"""
|
@@ -190,8 +197,8 @@ Feature: around hooks
|
|
190
197
|
"""
|
191
198
|
|
192
199
|
|
193
|
-
Scenario: explicitly pending examples
|
194
|
-
Given a file named "
|
200
|
+
Scenario: explicitly pending examples are detected as pending
|
201
|
+
Given a file named "example_spec.rb" with:
|
195
202
|
"""
|
196
203
|
describe "explicit pending example" do
|
197
204
|
around(:each) do |example|
|
@@ -203,7 +210,7 @@ Feature: around hooks
|
|
203
210
|
end
|
204
211
|
end
|
205
212
|
"""
|
206
|
-
When I run "rspec
|
213
|
+
When I run "rspec example_spec.rb"
|
207
214
|
Then the output should contain "1 example, 0 failures, 1 pending"
|
208
215
|
And the output should contain:
|
209
216
|
"""
|
@@ -211,8 +218,8 @@ Feature: around hooks
|
|
211
218
|
# No reason given
|
212
219
|
"""
|
213
220
|
|
214
|
-
Scenario: multiple around hooks in the same scope
|
215
|
-
Given a file named "
|
221
|
+
Scenario: multiple around hooks in the same scope
|
222
|
+
Given a file named "example_spec.rb" with:
|
216
223
|
"""
|
217
224
|
describe "if there are multiple around hooks in the same scope" do
|
218
225
|
around(:each) do |example|
|
@@ -233,7 +240,7 @@ Feature: around hooks
|
|
233
240
|
end
|
234
241
|
end
|
235
242
|
"""
|
236
|
-
When I run "rspec
|
243
|
+
When I run "rspec example_spec.rb"
|
237
244
|
Then the output should contain "1 example, 0 failure"
|
238
245
|
And the output should contain:
|
239
246
|
"""
|
@@ -244,8 +251,8 @@ Feature: around hooks
|
|
244
251
|
first around hook after
|
245
252
|
"""
|
246
253
|
|
247
|
-
Scenario: around hooks in
|
248
|
-
Given a file named "
|
254
|
+
Scenario: around hooks in multiple scopes
|
255
|
+
Given a file named "example_spec.rb" with:
|
249
256
|
"""
|
250
257
|
describe "if there are around hooks in an outer scope" do
|
251
258
|
around(:each) do |example|
|
@@ -293,7 +300,7 @@ Feature: around hooks
|
|
293
300
|
end
|
294
301
|
end
|
295
302
|
"""
|
296
|
-
When I run "rspec
|
303
|
+
When I run "rspec example_spec.rb"
|
297
304
|
Then the output should contain "1 example, 0 failure"
|
298
305
|
And the output should contain:
|
299
306
|
"""
|