rspec-core 2.12.2 → 2.13.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/Changelog.md +31 -0
- data/README.md +11 -10
- data/features/command_line/example_name_option.feature +6 -10
- data/features/command_line/tag.feature +15 -8
- data/features/configuration/backtrace_clean_patterns.feature +102 -0
- data/features/configuration/failure_exit_code.feature +36 -0
- data/features/configuration/order_and_seed.feature +3 -0
- data/features/configuration/output_stream.feature +24 -0
- data/features/configuration/pattern.feature +30 -0
- data/features/configuration/profile.feature +163 -0
- data/features/configuration/run_all_when_everything_filtered.feature +60 -0
- data/features/configuration/show_failures_in_pending_blocks.feature +61 -0
- data/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature +52 -0
- data/features/filtering/exclusion_filters.feature +1 -2
- data/features/formatters/configurable_colors.feature +31 -0
- data/features/step_definitions/additional_cli_steps.rb +21 -0
- data/features/subject/explicit_subject.feature +19 -0
- data/lib/autotest/rspec2.rb +1 -1
- data/lib/rspec/core.rb +1 -2
- data/lib/rspec/core/configuration.rb +33 -3
- data/lib/rspec/core/configuration_options.rb +5 -5
- data/lib/rspec/core/deprecation.rb +1 -1
- data/lib/rspec/core/example.rb +2 -2
- data/lib/rspec/core/example_group.rb +1 -3
- data/lib/rspec/core/formatters/base_text_formatter.rb +93 -27
- data/lib/rspec/core/formatters/documentation_formatter.rb +3 -3
- data/lib/rspec/core/formatters/progress_formatter.rb +3 -3
- data/lib/rspec/core/memoized_helpers.rb +425 -0
- data/lib/rspec/core/metadata.rb +6 -2
- data/lib/rspec/core/option_parser.rb +8 -2
- data/lib/rspec/core/pending.rb +7 -0
- data/lib/rspec/core/shared_context.rb +1 -1
- data/lib/rspec/core/version.rb +1 -1
- data/spec/autotest/failed_results_re_spec.rb +4 -4
- data/spec/autotest/rspec_spec.rb +25 -20
- data/spec/command_line/order_spec.rb +21 -21
- data/spec/rspec/core/command_line_spec.rb +6 -6
- data/spec/rspec/core/configuration_options_spec.rb +86 -72
- data/spec/rspec/core/configuration_spec.rb +161 -156
- data/spec/rspec/core/deprecations_spec.rb +4 -4
- data/spec/rspec/core/drb_command_line_spec.rb +9 -9
- data/spec/rspec/core/drb_options_spec.rb +46 -33
- data/spec/rspec/core/dsl_spec.rb +3 -3
- data/spec/rspec/core/example_group_spec.rb +156 -124
- data/spec/rspec/core/example_spec.rb +68 -52
- data/spec/rspec/core/filter_manager_spec.rb +36 -36
- data/spec/rspec/core/formatters/base_formatter_spec.rb +9 -9
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +104 -42
- data/spec/rspec/core/formatters/documentation_formatter_spec.rb +4 -4
- data/spec/rspec/core/formatters/helpers_spec.rb +13 -13
- data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +5 -17
- data/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html +159 -44
- data/spec/rspec/core/formatters/html_formatted-1.8.7.html +14 -14
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +20 -20
- data/spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html +5 -5
- data/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html +159 -44
- data/spec/rspec/core/formatters/html_formatted-1.9.3.html +20 -20
- data/spec/rspec/core/formatters/{html_formatted-1.9.2-jruby.html → html_formatted-2.0.0.html} +24 -18
- data/spec/rspec/core/formatters/html_formatter_spec.rb +9 -5
- data/spec/rspec/core/formatters/json_formatter_spec.rb +9 -9
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +4 -4
- data/spec/rspec/core/formatters/snippet_extractor_spec.rb +3 -3
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +5 -17
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-rbx.html +159 -44
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +16 -16
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +23 -23
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.3-jruby.html +5 -17
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.3-rbx.html +159 -44
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.3.html +23 -23
- data/spec/rspec/core/formatters/{text_mate_formatted-1.9.2-jruby.html → text_mate_formatted-2.0.0.html} +25 -19
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +8 -4
- data/spec/rspec/core/hooks_filtering_spec.rb +16 -16
- data/spec/rspec/core/hooks_spec.rb +11 -11
- data/spec/rspec/core/kernel_extensions_spec.rb +1 -1
- data/spec/rspec/core/memoized_helpers_spec.rb +458 -0
- data/spec/rspec/core/metadata_spec.rb +74 -74
- data/spec/rspec/core/option_parser_spec.rb +27 -27
- data/spec/rspec/core/pending_example_spec.rb +32 -32
- data/spec/rspec/core/project_initializer_spec.rb +8 -8
- data/spec/rspec/core/rake_task_spec.rb +16 -16
- data/spec/rspec/core/reporter_spec.rb +3 -3
- data/spec/rspec/core/resources/formatter_specs.rb +4 -4
- data/spec/rspec/core/ruby_project_spec.rb +4 -2
- data/spec/rspec/core/shared_context_spec.rb +34 -7
- data/spec/rspec/core/shared_example_group_spec.rb +14 -14
- data/spec/rspec/core/world_spec.rb +9 -9
- data/spec/rspec/core_spec.rb +5 -5
- data/spec/spec_helper.rb +4 -0
- data/spec/support/shared_example_groups.rb +4 -4
- data/spec/support/spec_files.rb +2 -2
- metadata +158 -150
- data/lib/rspec/core/let.rb +0 -110
- data/lib/rspec/core/subject.rb +0 -223
- data/spec/rspec/core/let_spec.rb +0 -55
- data/spec/rspec/core/subject_spec.rb +0 -255
|
@@ -19,7 +19,7 @@ describe "an example" do
|
|
|
19
19
|
end
|
|
20
20
|
example = group.examples.first
|
|
21
21
|
example.run(group.new, stub.as_null_object)
|
|
22
|
-
example.
|
|
22
|
+
expect(example).to be_pending_with('just because')
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it "sets the message to 'No reason given' if :pending => true" do
|
|
@@ -29,7 +29,7 @@ describe "an example" do
|
|
|
29
29
|
end
|
|
30
30
|
example = group.examples.first
|
|
31
31
|
example.run(group.new, stub.as_null_object)
|
|
32
|
-
example.
|
|
32
|
+
expect(example).to be_pending_with('No reason given')
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -40,7 +40,7 @@ describe "an example" do
|
|
|
40
40
|
end
|
|
41
41
|
example = group.examples.first
|
|
42
42
|
example.run(group.new, stub.as_null_object)
|
|
43
|
-
example.
|
|
43
|
+
expect(example).to be_pending_with('Not yet implemented')
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -53,7 +53,7 @@ describe "an example" do
|
|
|
53
53
|
end
|
|
54
54
|
example = group.examples.first
|
|
55
55
|
example.run(group.new, stub.as_null_object)
|
|
56
|
-
example.
|
|
56
|
+
expect(example).to be_pending_with(RSpec::Core::Pending::NO_REASON_GIVEN)
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
|
@@ -62,15 +62,15 @@ describe "an example" do
|
|
|
62
62
|
it "does not have an auto-generated description" do
|
|
63
63
|
group = RSpec::Core::ExampleGroup.describe('group') do
|
|
64
64
|
it "checks something" do
|
|
65
|
-
(3+4).
|
|
65
|
+
expect((3+4)).to eq(7)
|
|
66
66
|
end
|
|
67
67
|
pending do
|
|
68
|
-
"string".reverse.
|
|
68
|
+
expect("string".reverse).to eq("gnirts")
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
example = group.examples.last
|
|
72
72
|
example.run(group.new, stub.as_null_object)
|
|
73
|
-
example.description.
|
|
73
|
+
expect(example.description).to match(/example at/)
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
76
|
|
|
@@ -78,7 +78,7 @@ describe "an example" do
|
|
|
78
78
|
it "does not show any message" do
|
|
79
79
|
group = RSpec::Core::ExampleGroup.describe('group') do
|
|
80
80
|
it "checks something" do
|
|
81
|
-
(3+4).
|
|
81
|
+
expect((3+4)).to eq(7)
|
|
82
82
|
end
|
|
83
83
|
specify do
|
|
84
84
|
pending
|
|
@@ -86,7 +86,7 @@ describe "an example" do
|
|
|
86
86
|
end
|
|
87
87
|
example = group.examples.last
|
|
88
88
|
example.run(group.new, stub.as_null_object)
|
|
89
|
-
example.description.
|
|
89
|
+
expect(example.description).to match(/example at/)
|
|
90
90
|
end
|
|
91
91
|
end
|
|
92
92
|
end
|
|
@@ -100,7 +100,7 @@ describe "an example" do
|
|
|
100
100
|
end
|
|
101
101
|
example = group.examples.first
|
|
102
102
|
example.run(group.new, stub.as_null_object)
|
|
103
|
-
example.
|
|
103
|
+
expect(example).to be_pending_with('just because')
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
106
|
|
|
@@ -123,45 +123,45 @@ describe "an example" do
|
|
|
123
123
|
|
|
124
124
|
context "when given no options" do
|
|
125
125
|
it "is listed as pending with the supplied message" do
|
|
126
|
-
run_example("just because").
|
|
126
|
+
expect(run_example("just because")).to be_pending_with("just because")
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
it "is listed as pending with the default message when no message is given" do
|
|
130
|
-
run_example.
|
|
130
|
+
expect(run_example).to be_pending_with(RSpec::Core::Pending::NO_REASON_GIVEN)
|
|
131
131
|
end
|
|
132
132
|
end
|
|
133
133
|
|
|
134
134
|
context "when given a truthy :if option" do
|
|
135
135
|
it "is listed as pending with the supplied message" do
|
|
136
|
-
run_example("just because", :if => true).
|
|
136
|
+
expect(run_example("just because", :if => true)).to be_pending_with("just because")
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
it "is listed as pending with the default message when no message is given" do
|
|
140
|
-
run_example(:if => true).
|
|
140
|
+
expect(run_example(:if => true)).to be_pending_with(RSpec::Core::Pending::NO_REASON_GIVEN)
|
|
141
141
|
end
|
|
142
142
|
end
|
|
143
143
|
|
|
144
144
|
context "when given a falsey :if option" do
|
|
145
145
|
it "runs the example and fails" do
|
|
146
|
-
run_example( :if => false).
|
|
147
|
-
run_example("just because", :if => false).
|
|
146
|
+
expect(run_example( :if => false)).to fail_with(ArgumentError)
|
|
147
|
+
expect(run_example("just because", :if => false)).to fail_with(ArgumentError)
|
|
148
148
|
end
|
|
149
149
|
end
|
|
150
150
|
|
|
151
151
|
context "when given a truthy :unless option" do
|
|
152
152
|
it "runs the example and fails" do
|
|
153
|
-
run_example( :unless => true).
|
|
154
|
-
run_example("just because", :unless => true).
|
|
153
|
+
expect(run_example( :unless => true)).to fail_with(ArgumentError)
|
|
154
|
+
expect(run_example("just because", :unless => true)).to fail_with(ArgumentError)
|
|
155
155
|
end
|
|
156
156
|
end
|
|
157
157
|
|
|
158
158
|
context "when given a falsey :unless option" do
|
|
159
159
|
it "is listed as pending with the supplied message" do
|
|
160
|
-
run_example("just because", :unless => false).
|
|
160
|
+
expect(run_example("just because", :unless => false)).to be_pending_with("just because")
|
|
161
161
|
end
|
|
162
162
|
|
|
163
163
|
it "is listed as pending with the default message when no message is given" do
|
|
164
|
-
run_example(:unless => false).
|
|
164
|
+
expect(run_example(:unless => false)).to be_pending_with(RSpec::Core::Pending::NO_REASON_GIVEN)
|
|
165
165
|
end
|
|
166
166
|
end
|
|
167
167
|
end
|
|
@@ -172,47 +172,47 @@ describe "an example" do
|
|
|
172
172
|
end
|
|
173
173
|
|
|
174
174
|
it "passes" do
|
|
175
|
-
run_example("just because").
|
|
175
|
+
expect(run_example("just because")).to be_pending
|
|
176
176
|
end
|
|
177
177
|
end
|
|
178
178
|
|
|
179
179
|
context "that passes" do
|
|
180
180
|
def run_example(*pending_args)
|
|
181
|
-
super(*pending_args) { 3.
|
|
181
|
+
super(*pending_args) { expect(3).to eq(3) }
|
|
182
182
|
end
|
|
183
183
|
|
|
184
184
|
context "when given no options" do
|
|
185
185
|
it "fails with a PendingExampleFixedError" do
|
|
186
|
-
run_example("just because").
|
|
187
|
-
run_example.
|
|
186
|
+
expect(run_example("just because")).to fail_with(RSpec::Core::Pending::PendingExampleFixedError)
|
|
187
|
+
expect(run_example).to fail_with(RSpec::Core::Pending::PendingExampleFixedError)
|
|
188
188
|
end
|
|
189
189
|
end
|
|
190
190
|
|
|
191
191
|
context "when given a truthy :if option" do
|
|
192
192
|
it "fails with a PendingExampleFixedError" do
|
|
193
|
-
run_example("just because", :if => true).
|
|
194
|
-
run_example( :if => true).
|
|
193
|
+
expect(run_example("just because", :if => true)).to fail_with(RSpec::Core::Pending::PendingExampleFixedError)
|
|
194
|
+
expect(run_example( :if => true)).to fail_with(RSpec::Core::Pending::PendingExampleFixedError)
|
|
195
195
|
end
|
|
196
196
|
end
|
|
197
197
|
|
|
198
198
|
context "when given a falsey :if option" do
|
|
199
199
|
it "runs the example and it passes" do
|
|
200
|
-
run_example( :if => false).
|
|
201
|
-
run_example("just because", :if => false).
|
|
200
|
+
expect(run_example( :if => false)).to pass
|
|
201
|
+
expect(run_example("just because", :if => false)).to pass
|
|
202
202
|
end
|
|
203
203
|
end
|
|
204
204
|
|
|
205
205
|
context "when given a truthy :unless option" do
|
|
206
206
|
it "runs the example and it passes" do
|
|
207
|
-
run_example( :unless => true).
|
|
208
|
-
run_example("just because", :unless => true).
|
|
207
|
+
expect(run_example( :unless => true)).to pass
|
|
208
|
+
expect(run_example("just because", :unless => true)).to pass
|
|
209
209
|
end
|
|
210
210
|
end
|
|
211
211
|
|
|
212
212
|
context "when given a falsey :unless option" do
|
|
213
213
|
it "fails with a PendingExampleFixedError" do
|
|
214
|
-
run_example("just because", :unless => false).
|
|
215
|
-
run_example( :unless => false).
|
|
214
|
+
expect(run_example("just because", :unless => false)).to fail_with(RSpec::Core::Pending::PendingExampleFixedError)
|
|
215
|
+
expect(run_example( :unless => false)).to fail_with(RSpec::Core::Pending::PendingExampleFixedError)
|
|
216
216
|
end
|
|
217
217
|
end
|
|
218
218
|
end
|
|
@@ -21,7 +21,7 @@ module RSpec::Core
|
|
|
21
21
|
|
|
22
22
|
it "generates a .rspec" do
|
|
23
23
|
command_line_config.run
|
|
24
|
-
File.read('.rspec').
|
|
24
|
+
expect(File.read('.rspec')).to match /--color\n--format progress/m
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -35,7 +35,7 @@ module RSpec::Core
|
|
|
35
35
|
it "doesn't create a new one" do
|
|
36
36
|
File.open('.rspec', 'w') {|f| f << '--color'}
|
|
37
37
|
command_line_config.run
|
|
38
|
-
File.read('.rspec').
|
|
38
|
+
expect(File.read('.rspec')).to eq('--color')
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -47,7 +47,7 @@ module RSpec::Core
|
|
|
47
47
|
|
|
48
48
|
it "generates a spec/spec_helper.rb" do
|
|
49
49
|
command_line_config.run
|
|
50
|
-
File.read('spec/spec_helper.rb').
|
|
50
|
+
expect(File.read('spec/spec_helper.rb')).to match /RSpec\.configure do \|config\|/m
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -64,7 +64,7 @@ module RSpec::Core
|
|
|
64
64
|
random_content = "content #{rand}"
|
|
65
65
|
File.open('spec/spec_helper.rb', 'w') {|f| f << random_content}
|
|
66
66
|
command_line_config.run
|
|
67
|
-
File.read('spec/spec_helper.rb').
|
|
67
|
+
expect(File.read('spec/spec_helper.rb')).to eq(random_content)
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
|
|
@@ -82,13 +82,13 @@ module RSpec::Core
|
|
|
82
82
|
it "removes it if confirmed" do
|
|
83
83
|
command_line_config.stub(:gets => 'yes')
|
|
84
84
|
command_line_config.run
|
|
85
|
-
File.exist?('autotest/discover.rb').
|
|
85
|
+
expect(File.exist?('autotest/discover.rb')).to be_false
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
it "leaves it if not confirmed" do
|
|
89
89
|
command_line_config.stub(:gets => 'no')
|
|
90
90
|
command_line_config.run
|
|
91
|
-
File.exist?('autotest/discover.rb').
|
|
91
|
+
expect(File.exist?('autotest/discover.rb')).to be_true
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
|
|
@@ -106,13 +106,13 @@ module RSpec::Core
|
|
|
106
106
|
it "removes it if confirmed" do
|
|
107
107
|
command_line_config.stub(:gets => 'yes')
|
|
108
108
|
command_line_config.run
|
|
109
|
-
File.exist?('lib/tasks/rspec.rake').
|
|
109
|
+
expect(File.exist?('lib/tasks/rspec.rake')).to be_false
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
it "leaves it if not confirmed" do
|
|
113
113
|
command_line_config.stub(:gets => 'no')
|
|
114
114
|
command_line_config.run
|
|
115
|
-
File.exist?('lib/tasks/rspec.rake').
|
|
115
|
+
expect(File.exist?('lib/tasks/rspec.rake')).to be_true
|
|
116
116
|
end
|
|
117
117
|
end
|
|
118
118
|
end
|
|
@@ -23,31 +23,31 @@ module RSpec::Core
|
|
|
23
23
|
let(:task) { RakeTask.new(:task_name) }
|
|
24
24
|
|
|
25
25
|
it "correctly sets the name" do
|
|
26
|
-
task.name.
|
|
26
|
+
expect(task.name).to eq :task_name
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
context "with args passed to the rake task" do
|
|
31
31
|
it "correctly passes along task arguments" do
|
|
32
32
|
task = RakeTask.new(:rake_task_args, :files) do |t, args|
|
|
33
|
-
args[:files].
|
|
33
|
+
expect(args[:files]).to eq "first_spec.rb"
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
task.should_receive(:run_task) { true }
|
|
37
|
-
Rake.application.invoke_task("rake_task_args[first_spec.rb]").
|
|
37
|
+
expect(Rake.application.invoke_task("rake_task_args[first_spec.rb]")).to be_true
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
context "default" do
|
|
42
42
|
it "renders rspec" do
|
|
43
|
-
spec_command.
|
|
43
|
+
expect(spec_command).to match /^#{ruby} -S rspec/
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
context "with rcov" do
|
|
48
48
|
it "renders rcov" do
|
|
49
49
|
with_rcov do
|
|
50
|
-
spec_command.
|
|
50
|
+
expect(spec_command).to match /^#{ruby} -S rcov/
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
end
|
|
@@ -55,7 +55,7 @@ module RSpec::Core
|
|
|
55
55
|
context "with ruby options" do
|
|
56
56
|
it "renders them before -S" do
|
|
57
57
|
task.ruby_opts = "-w"
|
|
58
|
-
spec_command.
|
|
58
|
+
expect(spec_command).to match /^#{ruby} -w -S rspec/
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
@@ -63,7 +63,7 @@ module RSpec::Core
|
|
|
63
63
|
context "with rcov=false (default)" do
|
|
64
64
|
it "does not add the rcov options to the command" do
|
|
65
65
|
task.rcov_opts = '--exclude "mocks"'
|
|
66
|
-
spec_command.
|
|
66
|
+
expect(spec_command).not_to match /--exclude "mocks"/
|
|
67
67
|
end
|
|
68
68
|
end
|
|
69
69
|
|
|
@@ -71,13 +71,13 @@ module RSpec::Core
|
|
|
71
71
|
it "renders them after rcov" do
|
|
72
72
|
task.rcov = true
|
|
73
73
|
task.rcov_opts = '--exclude "mocks"'
|
|
74
|
-
spec_command.
|
|
74
|
+
expect(spec_command).to match /rcov.*--exclude "mocks"/
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
it "ensures that -Ispec:lib is in the resulting command" do
|
|
78
78
|
task.rcov = true
|
|
79
79
|
task.rcov_opts = '--exclude "mocks"'
|
|
80
|
-
spec_command.
|
|
80
|
+
expect(spec_command).to match /rcov.*-Ispec:lib/
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
83
|
end
|
|
@@ -88,13 +88,13 @@ module RSpec::Core
|
|
|
88
88
|
task.stub(:files_to_run) { "this.rb that.rb" }
|
|
89
89
|
task.rcov = true
|
|
90
90
|
task.rspec_opts = "-Ifoo"
|
|
91
|
-
spec_command.
|
|
91
|
+
expect(spec_command).to match /this.rb that.rb -- -Ifoo/
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
context "with rcov=false (default)" do
|
|
95
95
|
it "adds the rspec_opts" do
|
|
96
96
|
task.rspec_opts = "-Ifoo"
|
|
97
|
-
spec_command.
|
|
97
|
+
expect(spec_command).to match /rspec.*-Ifoo/
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
100
|
end
|
|
@@ -109,13 +109,13 @@ module RSpec::Core
|
|
|
109
109
|
task.__send__(:files_to_run)
|
|
110
110
|
end
|
|
111
111
|
|
|
112
|
-
orderings.uniq.size.
|
|
112
|
+
expect(orderings.uniq.size).to eq(1)
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
context "with SPEC env var set" do
|
|
116
116
|
it "sets files to run" do
|
|
117
117
|
with_env_vars 'SPEC' => 'path/to/file' do
|
|
118
|
-
task.__send__(:files_to_run).
|
|
118
|
+
expect(task.__send__(:files_to_run)).to eq(["path/to/file"])
|
|
119
119
|
end
|
|
120
120
|
end
|
|
121
121
|
|
|
@@ -134,7 +134,7 @@ module RSpec::Core
|
|
|
134
134
|
# since the config block is deferred til task invocation, must fake
|
|
135
135
|
# calling the task so the expected pattern is picked up
|
|
136
136
|
task.should_receive(:run_task) { true }
|
|
137
|
-
Rake.application.invoke_task(task.name).
|
|
137
|
+
expect(Rake.application.invoke_task(task.name)).to be_true
|
|
138
138
|
|
|
139
139
|
specify_consistent_ordering_of_files_to_run('a/*.rb', task)
|
|
140
140
|
end
|
|
@@ -145,7 +145,7 @@ module RSpec::Core
|
|
|
145
145
|
["first_spec.rb", "second_\"spec.rb", "third_\'spec.rb", "fourth spec.rb"].each do |file_name|
|
|
146
146
|
FileUtils.touch(File.join(Dir.tmpdir, file_name))
|
|
147
147
|
end
|
|
148
|
-
task.__send__(:files_to_run).sort.
|
|
148
|
+
expect(task.__send__(:files_to_run).sort).to eq([
|
|
149
149
|
File.join(Dir.tmpdir, "first_spec.rb"),
|
|
150
150
|
File.join(Dir.tmpdir, "fourth\\ spec.rb"),
|
|
151
151
|
File.join(Dir.tmpdir, "second_\\\"spec.rb"),
|
|
@@ -170,7 +170,7 @@ module RSpec::Core
|
|
|
170
170
|
FileUtils.ln_s bars_dir, File.join(project_dir, "spec/bars")
|
|
171
171
|
|
|
172
172
|
FileUtils.cd(project_dir) do
|
|
173
|
-
RakeTask.new.__send__(:files_to_run).sort.
|
|
173
|
+
expect(RakeTask.new.__send__(:files_to_run).sort).to eq([
|
|
174
174
|
"./spec/bars/bar_spec.rb",
|
|
175
175
|
"./spec/foos/foo_spec.rb"
|
|
176
176
|
])
|
|
@@ -44,7 +44,7 @@ module RSpec::Core
|
|
|
44
44
|
|
|
45
45
|
group.run(Reporter.new(formatter))
|
|
46
46
|
|
|
47
|
-
order.
|
|
47
|
+
expect(order).to eq([
|
|
48
48
|
"Started: root",
|
|
49
49
|
"Started: context 1",
|
|
50
50
|
"Finished: context 1",
|
|
@@ -96,7 +96,7 @@ module RSpec::Core
|
|
|
96
96
|
reporter = Reporter.new
|
|
97
97
|
yielded = nil
|
|
98
98
|
reporter.report(3) {|r| yielded = r}
|
|
99
|
-
yielded.
|
|
99
|
+
expect(yielded).to eq(reporter)
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
102
|
|
|
@@ -113,7 +113,7 @@ module RSpec::Core
|
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
reporter.finish 1234
|
|
116
|
-
duration.
|
|
116
|
+
expect(duration).to be < 0.2
|
|
117
117
|
end
|
|
118
118
|
end
|
|
119
119
|
end
|
|
@@ -8,7 +8,7 @@ describe "pending command with block format" do
|
|
|
8
8
|
context "with content that would fail" do
|
|
9
9
|
it "is pending" do
|
|
10
10
|
pending do
|
|
11
|
-
1.
|
|
11
|
+
expect(1).to eq(2)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
end
|
|
@@ -16,7 +16,7 @@ describe "pending command with block format" do
|
|
|
16
16
|
context "with content that would pass" do
|
|
17
17
|
it "fails" do
|
|
18
18
|
pending do
|
|
19
|
-
1.
|
|
19
|
+
expect(1).to eq(1)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
end
|
|
@@ -24,13 +24,13 @@ end
|
|
|
24
24
|
|
|
25
25
|
describe "passing spec" do
|
|
26
26
|
it "passes" do
|
|
27
|
-
1.
|
|
27
|
+
expect(1).to eq(1)
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
describe "failing spec" do
|
|
32
32
|
it "fails" do
|
|
33
|
-
1.
|
|
33
|
+
expect(1).to eq(2)
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
1
3
|
module RSpec
|
|
2
4
|
module Core
|
|
3
5
|
describe RubyProject do
|
|
@@ -7,14 +9,14 @@ module RSpec
|
|
|
7
9
|
context "with ancestor containing spec directory" do
|
|
8
10
|
it "returns ancestor containing the spec directory" do
|
|
9
11
|
RubyProject.stub(:ascend_until).and_return('foodir')
|
|
10
|
-
RubyProject.determine_root.
|
|
12
|
+
expect(RubyProject.determine_root).to eq("foodir")
|
|
11
13
|
end
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
context "without ancestor containing spec directory" do
|
|
15
17
|
it "returns current working directory" do
|
|
16
18
|
RubyProject.stub(:find_first_parent_containing).and_return(nil)
|
|
17
|
-
RubyProject.determine_root.
|
|
19
|
+
expect(RubyProject.determine_root).to eq(".")
|
|
18
20
|
end
|
|
19
21
|
end
|
|
20
22
|
|