rspec-core 2.12.2 → 2.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/Changelog.md +31 -0
  2. data/README.md +11 -10
  3. data/features/command_line/example_name_option.feature +6 -10
  4. data/features/command_line/tag.feature +15 -8
  5. data/features/configuration/backtrace_clean_patterns.feature +102 -0
  6. data/features/configuration/failure_exit_code.feature +36 -0
  7. data/features/configuration/order_and_seed.feature +3 -0
  8. data/features/configuration/output_stream.feature +24 -0
  9. data/features/configuration/pattern.feature +30 -0
  10. data/features/configuration/profile.feature +163 -0
  11. data/features/configuration/run_all_when_everything_filtered.feature +60 -0
  12. data/features/configuration/show_failures_in_pending_blocks.feature +61 -0
  13. data/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature +52 -0
  14. data/features/filtering/exclusion_filters.feature +1 -2
  15. data/features/formatters/configurable_colors.feature +31 -0
  16. data/features/step_definitions/additional_cli_steps.rb +21 -0
  17. data/features/subject/explicit_subject.feature +19 -0
  18. data/lib/autotest/rspec2.rb +1 -1
  19. data/lib/rspec/core.rb +1 -2
  20. data/lib/rspec/core/configuration.rb +33 -3
  21. data/lib/rspec/core/configuration_options.rb +5 -5
  22. data/lib/rspec/core/deprecation.rb +1 -1
  23. data/lib/rspec/core/example.rb +2 -2
  24. data/lib/rspec/core/example_group.rb +1 -3
  25. data/lib/rspec/core/formatters/base_text_formatter.rb +93 -27
  26. data/lib/rspec/core/formatters/documentation_formatter.rb +3 -3
  27. data/lib/rspec/core/formatters/progress_formatter.rb +3 -3
  28. data/lib/rspec/core/memoized_helpers.rb +425 -0
  29. data/lib/rspec/core/metadata.rb +6 -2
  30. data/lib/rspec/core/option_parser.rb +8 -2
  31. data/lib/rspec/core/pending.rb +7 -0
  32. data/lib/rspec/core/shared_context.rb +1 -1
  33. data/lib/rspec/core/version.rb +1 -1
  34. data/spec/autotest/failed_results_re_spec.rb +4 -4
  35. data/spec/autotest/rspec_spec.rb +25 -20
  36. data/spec/command_line/order_spec.rb +21 -21
  37. data/spec/rspec/core/command_line_spec.rb +6 -6
  38. data/spec/rspec/core/configuration_options_spec.rb +86 -72
  39. data/spec/rspec/core/configuration_spec.rb +161 -156
  40. data/spec/rspec/core/deprecations_spec.rb +4 -4
  41. data/spec/rspec/core/drb_command_line_spec.rb +9 -9
  42. data/spec/rspec/core/drb_options_spec.rb +46 -33
  43. data/spec/rspec/core/dsl_spec.rb +3 -3
  44. data/spec/rspec/core/example_group_spec.rb +156 -124
  45. data/spec/rspec/core/example_spec.rb +68 -52
  46. data/spec/rspec/core/filter_manager_spec.rb +36 -36
  47. data/spec/rspec/core/formatters/base_formatter_spec.rb +9 -9
  48. data/spec/rspec/core/formatters/base_text_formatter_spec.rb +104 -42
  49. data/spec/rspec/core/formatters/documentation_formatter_spec.rb +4 -4
  50. data/spec/rspec/core/formatters/helpers_spec.rb +13 -13
  51. data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +5 -17
  52. data/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html +159 -44
  53. data/spec/rspec/core/formatters/html_formatted-1.8.7.html +14 -14
  54. data/spec/rspec/core/formatters/html_formatted-1.9.2.html +20 -20
  55. data/spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html +5 -5
  56. data/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html +159 -44
  57. data/spec/rspec/core/formatters/html_formatted-1.9.3.html +20 -20
  58. data/spec/rspec/core/formatters/{html_formatted-1.9.2-jruby.html → html_formatted-2.0.0.html} +24 -18
  59. data/spec/rspec/core/formatters/html_formatter_spec.rb +9 -5
  60. data/spec/rspec/core/formatters/json_formatter_spec.rb +9 -9
  61. data/spec/rspec/core/formatters/progress_formatter_spec.rb +4 -4
  62. data/spec/rspec/core/formatters/snippet_extractor_spec.rb +3 -3
  63. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +5 -17
  64. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-rbx.html +159 -44
  65. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +16 -16
  66. data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +23 -23
  67. data/spec/rspec/core/formatters/text_mate_formatted-1.9.3-jruby.html +5 -17
  68. data/spec/rspec/core/formatters/text_mate_formatted-1.9.3-rbx.html +159 -44
  69. data/spec/rspec/core/formatters/text_mate_formatted-1.9.3.html +23 -23
  70. data/spec/rspec/core/formatters/{text_mate_formatted-1.9.2-jruby.html → text_mate_formatted-2.0.0.html} +25 -19
  71. data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +8 -4
  72. data/spec/rspec/core/hooks_filtering_spec.rb +16 -16
  73. data/spec/rspec/core/hooks_spec.rb +11 -11
  74. data/spec/rspec/core/kernel_extensions_spec.rb +1 -1
  75. data/spec/rspec/core/memoized_helpers_spec.rb +458 -0
  76. data/spec/rspec/core/metadata_spec.rb +74 -74
  77. data/spec/rspec/core/option_parser_spec.rb +27 -27
  78. data/spec/rspec/core/pending_example_spec.rb +32 -32
  79. data/spec/rspec/core/project_initializer_spec.rb +8 -8
  80. data/spec/rspec/core/rake_task_spec.rb +16 -16
  81. data/spec/rspec/core/reporter_spec.rb +3 -3
  82. data/spec/rspec/core/resources/formatter_specs.rb +4 -4
  83. data/spec/rspec/core/ruby_project_spec.rb +4 -2
  84. data/spec/rspec/core/shared_context_spec.rb +34 -7
  85. data/spec/rspec/core/shared_example_group_spec.rb +14 -14
  86. data/spec/rspec/core/world_spec.rb +9 -9
  87. data/spec/rspec/core_spec.rb +5 -5
  88. data/spec/spec_helper.rb +4 -0
  89. data/spec/support/shared_example_groups.rb +4 -4
  90. data/spec/support/spec_files.rb +2 -2
  91. metadata +158 -150
  92. data/lib/rspec/core/let.rb +0 -110
  93. data/lib/rspec/core/subject.rb +0 -223
  94. data/spec/rspec/core/let_spec.rb +0 -55
  95. data/spec/rspec/core/subject_spec.rb +0 -255
@@ -7,20 +7,20 @@ module RSpec
7
7
  describe '.relative_path' do
8
8
  let(:here) { File.expand_path(".") }
9
9
  it "transforms absolute paths to relative paths" do
10
- Metadata.relative_path(here).should == "."
10
+ expect(Metadata.relative_path(here)).to eq "."
11
11
  end
12
12
  it "transforms absolute paths to relative paths anywhere in its argument" do
13
- Metadata.relative_path("foo #{here} bar").should == "foo . bar"
13
+ expect(Metadata.relative_path("foo #{here} bar")).to eq "foo . bar"
14
14
  end
15
15
  it "returns nil if passed an unparseable file:line combo" do
16
- Metadata.relative_path("-e:1").should be_nil
16
+ expect(Metadata.relative_path("-e:1")).to be_nil
17
17
  end
18
18
  # I have no idea what line = line.sub(/\A([^:]+:\d+)$/, '\\1') is supposed to do
19
19
  it "gracefully returns nil if run in a secure thread" do
20
20
  safely do
21
21
  value = Metadata.relative_path(".")
22
22
  # on some rubies, File.expand_path is not a security error, so accept "." as well
23
- [nil, "."].should include(value)
23
+ expect([nil, "."]).to include(value)
24
24
  end
25
25
  end
26
26
 
@@ -39,7 +39,7 @@ module RSpec
39
39
  it "uses :caller if passed as part of the user metadata" do
40
40
  m = Metadata.new
41
41
  m.process('group', :caller => ['example_file:42'])
42
- m[:example_group][:location].should eq("example_file:42")
42
+ expect(m[:example_group][:location]).to eq("example_file:42")
43
43
  end
44
44
  end
45
45
 
@@ -69,27 +69,27 @@ module RSpec
69
69
  it "matches the group when the line_number is the example group line number" do
70
70
  # this call doesn't really make sense since filter_applies? is only called
71
71
  # for example metadata not group metadata
72
- group_metadata.filter_applies?(condition_key, group_condition).should be_true
72
+ expect(group_metadata.filter_applies?(condition_key, group_condition)).to be_true
73
73
  end
74
74
 
75
75
  it "matches the example when the line_number is the grandparent example group line number" do
76
- example_metadata.filter_applies?(condition_key, parent_group_condition).should be_true
76
+ expect(example_metadata.filter_applies?(condition_key, parent_group_condition)).to be_true
77
77
  end
78
78
 
79
79
  it "matches the example when the line_number is the parent example group line number" do
80
- example_metadata.filter_applies?(condition_key, group_condition).should be_true
80
+ expect(example_metadata.filter_applies?(condition_key, group_condition)).to be_true
81
81
  end
82
82
 
83
83
  it "matches the example when the line_number is the example line number" do
84
- example_metadata.filter_applies?(condition_key, example_condition).should be_true
84
+ expect(example_metadata.filter_applies?(condition_key, example_condition)).to be_true
85
85
  end
86
86
 
87
87
  it "matches when the line number is between this example and the next" do
88
- example_metadata.filter_applies?(condition_key, between_examples_condition).should be_true
88
+ expect(example_metadata.filter_applies?(condition_key, between_examples_condition)).to be_true
89
89
  end
90
90
 
91
91
  it "does not match when the line number matches the next example" do
92
- example_metadata.filter_applies?(condition_key, next_example_condition).should be_false
92
+ expect(example_metadata.filter_applies?(condition_key, next_example_condition)).to be_false
93
93
  end
94
94
  end
95
95
 
@@ -136,25 +136,25 @@ module RSpec
136
136
  it_has_behavior "matching by line number"
137
137
 
138
138
  it "ignores location filters for other files" do
139
- example_metadata.filter_applies?(:locations, {"/path/to/other_spec.rb" => [3,5,7]}).should be_true
139
+ expect(example_metadata.filter_applies?(:locations, {"/path/to/other_spec.rb" => [3,5,7]})).to be_true
140
140
  end
141
141
  end
142
142
 
143
143
  it "matches a proc with no arguments that evaluates to true" do
144
- example_metadata.filter_applies?(:if, lambda { true }).should be_true
144
+ expect(example_metadata.filter_applies?(:if, lambda { true })).to be_true
145
145
  end
146
146
 
147
147
  it "matches a proc that evaluates to true" do
148
- example_metadata.filter_applies?(:if, lambda { |v| v }).should be_true
148
+ expect(example_metadata.filter_applies?(:if, lambda { |v| v })).to be_true
149
149
  end
150
150
 
151
151
  it "does not match a proc that evaluates to false" do
152
- example_metadata.filter_applies?(:if, lambda { |v| !v }).should be_false
152
+ expect(example_metadata.filter_applies?(:if, lambda { |v| !v })).to be_false
153
153
  end
154
154
 
155
155
  it "matches a proc with an arity of 2" do
156
156
  example_metadata[:foo] = nil
157
- example_metadata.filter_applies?(:foo, lambda { |v, m| m == example_metadata }).should be_true
157
+ expect(example_metadata.filter_applies?(:foo, lambda { |v, m| m == example_metadata })).to be_true
158
158
  end
159
159
 
160
160
  it "raises an error when the proc has an incorrect arity" do
@@ -169,35 +169,35 @@ module RSpec
169
169
  }
170
170
 
171
171
  it "matches a symbol" do
172
- metadata_with_array.filter_applies?(:tag, 'one').should be_true
173
- metadata_with_array.filter_applies?(:tag, :one).should be_true
174
- metadata_with_array.filter_applies?(:tag, 'two').should be_false
172
+ expect(metadata_with_array.filter_applies?(:tag, 'one')).to be_true
173
+ expect(metadata_with_array.filter_applies?(:tag, :one)).to be_true
174
+ expect(metadata_with_array.filter_applies?(:tag, 'two')).to be_false
175
175
  end
176
176
 
177
177
  it "matches a string" do
178
- metadata_with_array.filter_applies?(:tag, 'three').should be_true
179
- metadata_with_array.filter_applies?(:tag, :three).should be_true
180
- metadata_with_array.filter_applies?(:tag, 'tree').should be_false
178
+ expect(metadata_with_array.filter_applies?(:tag, 'three')).to be_true
179
+ expect(metadata_with_array.filter_applies?(:tag, :three)).to be_true
180
+ expect(metadata_with_array.filter_applies?(:tag, 'tree')).to be_false
181
181
  end
182
182
 
183
183
  it "matches an integer" do
184
- metadata_with_array.filter_applies?(:tag, '2').should be_true
185
- metadata_with_array.filter_applies?(:tag, 2).should be_true
186
- metadata_with_array.filter_applies?(:tag, 3).should be_false
184
+ expect(metadata_with_array.filter_applies?(:tag, '2')).to be_true
185
+ expect(metadata_with_array.filter_applies?(:tag, 2)).to be_true
186
+ expect(metadata_with_array.filter_applies?(:tag, 3)).to be_false
187
187
  end
188
188
 
189
189
  it "matches a regexp" do
190
- metadata_with_array.filter_applies?(:tag, 'four').should be_true
191
- metadata_with_array.filter_applies?(:tag, 'fourtune').should be_true
192
- metadata_with_array.filter_applies?(:tag, 'fortune').should be_false
190
+ expect(metadata_with_array.filter_applies?(:tag, 'four')).to be_true
191
+ expect(metadata_with_array.filter_applies?(:tag, 'fourtune')).to be_true
192
+ expect(metadata_with_array.filter_applies?(:tag, 'fortune')).to be_false
193
193
  end
194
194
 
195
195
  it "matches a proc that evaluates to true" do
196
- metadata_with_array.filter_applies?(:tag, lambda { |values| values.include? 'three' }).should be_true
196
+ expect(metadata_with_array.filter_applies?(:tag, lambda { |values| values.include? 'three' })).to be_true
197
197
  end
198
198
 
199
199
  it "does not match a proc that evaluates to false" do
200
- metadata_with_array.filter_applies?(:tag, lambda { |values| values.include? 'nothing' }).should be_false
200
+ expect(metadata_with_array.filter_applies?(:tag, lambda { |values| values.include? 'nothing' })).to be_false
201
201
  end
202
202
  end
203
203
  end
@@ -208,50 +208,50 @@ module RSpec
208
208
  let(:line_number) { __LINE__ - 1 }
209
209
 
210
210
  it "stores the description" do
211
- mfe.fetch(:description).should eq("example description")
212
- mfe[:description].should eq("example description")
211
+ expect(mfe.fetch(:description)).to eq("example description")
212
+ expect(mfe[:description]).to eq("example description")
213
213
  end
214
214
 
215
215
  it "stores the full_description (group description + example description)" do
216
- mfe.fetch(:full_description).should eq("group description example description")
217
- mfe[:full_description].should eq("group description example description")
216
+ expect(mfe.fetch(:full_description)).to eq("group description example description")
217
+ expect(mfe[:full_description]).to eq("group description example description")
218
218
  end
219
219
 
220
220
  it "creates an empty execution result" do
221
- mfe.fetch(:execution_result).should eq({})
222
- mfe[:execution_result].should eq({})
221
+ expect(mfe.fetch(:execution_result)).to eq({})
222
+ expect(mfe[:execution_result]).to eq({})
223
223
  end
224
224
 
225
225
  it "extracts file path from caller" do
226
- mfe.fetch(:file_path).should eq(relative_path(__FILE__))
227
- mfe[:file_path].should eq(relative_path(__FILE__))
226
+ expect(mfe.fetch(:file_path)).to eq(relative_path(__FILE__))
227
+ expect(mfe[:file_path]).to eq(relative_path(__FILE__))
228
228
  end
229
229
 
230
230
  it "extracts line number from caller" do
231
- mfe.fetch(:line_number).should eq(line_number)
232
- mfe[:line_number].should eq(line_number)
231
+ expect(mfe.fetch(:line_number)).to eq(line_number)
232
+ expect(mfe[:line_number]).to eq(line_number)
233
233
  end
234
234
 
235
235
  it "extracts location from caller" do
236
- mfe.fetch(:location).should eq("#{relative_path(__FILE__)}:#{line_number}")
237
- mfe[:location].should eq("#{relative_path(__FILE__)}:#{line_number}")
236
+ expect(mfe.fetch(:location)).to eq("#{relative_path(__FILE__)}:#{line_number}")
237
+ expect(mfe[:location]).to eq("#{relative_path(__FILE__)}:#{line_number}")
238
238
  end
239
239
 
240
240
  it "uses :caller if passed as an option" do
241
241
  example_metadata = metadata.for_example('example description', {:caller => ['example_file:42']})
242
- example_metadata[:location].should eq("example_file:42")
242
+ expect(example_metadata[:location]).to eq("example_file:42")
243
243
  end
244
244
 
245
245
  it "merges arbitrary options" do
246
- mfe.fetch(:arbitrary).should eq(:options)
247
- mfe[:arbitrary].should eq(:options)
246
+ expect(mfe.fetch(:arbitrary)).to eq(:options)
247
+ expect(mfe[:arbitrary]).to eq(:options)
248
248
  end
249
249
 
250
250
  it "points :example_group to the same hash object" do
251
251
  a = metadata.for_example("foo", {})[:example_group]
252
252
  b = metadata.for_example("bar", {})[:example_group]
253
253
  a[:description] = "new description"
254
- b[:description].should eq("new description")
254
+ expect(b[:description]).to eq("new description")
255
255
  end
256
256
  end
257
257
 
@@ -262,7 +262,7 @@ module RSpec
262
262
  m = Metadata.new
263
263
  m.process('group')
264
264
 
265
- m[:example_group][key].should be_nil
265
+ expect(m[:example_group][key]).to be_nil
266
266
  end
267
267
  end
268
268
 
@@ -271,7 +271,7 @@ module RSpec
271
271
  m = Metadata.new
272
272
  m.process(:group)
273
273
 
274
- m[:example_group][key].should be_nil
274
+ expect(m[:example_group][key]).to be_nil
275
275
  end
276
276
  end
277
277
 
@@ -280,7 +280,7 @@ module RSpec
280
280
  m = Metadata.new
281
281
  m.process(String)
282
282
 
283
- m[:example_group][key].should be(String)
283
+ expect(m[:example_group][key]).to be(String)
284
284
  end
285
285
  end
286
286
 
@@ -292,7 +292,7 @@ module RSpec
292
292
  m = Metadata.new(sm)
293
293
  m.process(Array)
294
294
 
295
- m[:example_group][key].should be(String)
295
+ expect(m[:example_group][key]).to be(String)
296
296
  end
297
297
 
298
298
  it "returns own described class if parent doesn't have one" do
@@ -302,7 +302,7 @@ module RSpec
302
302
  m = Metadata.new(sm)
303
303
  m.process(Array)
304
304
 
305
- m[:example_group][key].should be(Array)
305
+ expect(m[:example_group][key]).to be(Array)
306
306
  end
307
307
 
308
308
  it "can override a parent group's described class" do
@@ -316,9 +316,9 @@ module RSpec
316
316
  grandchild = Metadata.new(child)
317
317
  grandchild.process(Array)
318
318
 
319
- grandchild[:example_group][key].should be(Hash)
320
- child[:example_group][key].should be(Hash)
321
- parent[:example_group][key].should be(String)
319
+ expect(grandchild[:example_group][key]).to be(Hash)
320
+ expect(child[:example_group][key]).to be(Hash)
321
+ expect(parent[:example_group][key]).to be(String)
322
322
  end
323
323
  end
324
324
  end
@@ -330,7 +330,7 @@ module RSpec
330
330
  m.process("group")
331
331
 
332
332
  m = m.for_example("example", {})
333
- m[:description].should eq("example")
333
+ expect(m[:description]).to eq("example")
334
334
  end
335
335
 
336
336
  context "with a string" do
@@ -338,7 +338,7 @@ module RSpec
338
338
  m = Metadata.new
339
339
  m.process("group")
340
340
 
341
- m[:example_group][:description].should eq("group")
341
+ expect(m[:example_group][:description]).to eq("group")
342
342
  end
343
343
  end
344
344
 
@@ -347,7 +347,7 @@ module RSpec
347
347
  m = Metadata.new
348
348
  m.process("group")
349
349
 
350
- m[:example_group][:description].should eq("group")
350
+ expect(m[:example_group][:description]).to eq("group")
351
351
  end
352
352
  end
353
353
 
@@ -356,7 +356,7 @@ module RSpec
356
356
  m = Metadata.new
357
357
  m.process(Object, 'group')
358
358
 
359
- m[:example_group][:description].should eq("Object group")
359
+ expect(m[:example_group][:description]).to eq("Object group")
360
360
  end
361
361
  end
362
362
 
@@ -365,7 +365,7 @@ module RSpec
365
365
  m = Metadata.new
366
366
  m.process()
367
367
 
368
- m[:example_group][:description].should eq("")
368
+ expect(m[:example_group][:description]).to eq("")
369
369
  end
370
370
  end
371
371
  end
@@ -376,7 +376,7 @@ module RSpec
376
376
  group_metadata.process('group')
377
377
 
378
378
  example_metadata = group_metadata.for_example("example", {})
379
- example_metadata[:full_description].should eq("group example")
379
+ expect(example_metadata[:full_description]).to eq("group example")
380
380
  end
381
381
 
382
382
  it "concats nested example group descriptions" do
@@ -386,8 +386,8 @@ module RSpec
386
386
  child = Metadata.new(parent)
387
387
  child.process('child')
388
388
 
389
- child[:example_group][:full_description].should eq("parent child")
390
- child.for_example('example', child)[:full_description].should eq("parent child example")
389
+ expect(child[:example_group][:full_description]).to eq("parent child")
390
+ expect(child.for_example('example', child)[:full_description]).to eq("parent child example")
391
391
  end
392
392
 
393
393
  it "concats nested example group descriptions three deep" do
@@ -400,10 +400,10 @@ module RSpec
400
400
  child = Metadata.new(parent)
401
401
  child.process('child')
402
402
 
403
- grandparent[:example_group][:full_description].should eq("grandparent")
404
- parent[:example_group][:full_description].should eq("grandparent parent")
405
- child[:example_group][:full_description].should eq("grandparent parent child")
406
- child.for_example('example', child)[:full_description].should eq("grandparent parent child example")
403
+ expect(grandparent[:example_group][:full_description]).to eq("grandparent")
404
+ expect(parent[:example_group][:full_description]).to eq("grandparent parent")
405
+ expect(child[:example_group][:full_description]).to eq("grandparent parent child")
406
+ expect(child.for_example('example', child)[:full_description]).to eq("grandparent parent child example")
407
407
  end
408
408
 
409
409
  %w[# . ::].each do |char|
@@ -411,7 +411,7 @@ module RSpec
411
411
  it "removes the space" do
412
412
  m = Metadata.new
413
413
  m.process(Array, "#{char}method")
414
- m[:example_group][:full_description].should eq("Array#{char}method")
414
+ expect(m[:example_group][:full_description]).to eq("Array#{char}method")
415
415
  end
416
416
  end
417
417
 
@@ -421,7 +421,7 @@ module RSpec
421
421
  parent.process(Object)
422
422
  child = Metadata.new(parent)
423
423
  child.process("#{char}method")
424
- child[:example_group][:full_description].should eq("Object#{char}method")
424
+ expect(child[:example_group][:full_description]).to eq("Object#{char}method")
425
425
  end
426
426
  end
427
427
 
@@ -433,7 +433,7 @@ module RSpec
433
433
  parent.process("with 2 items")
434
434
  child = Metadata.new(parent)
435
435
  child.process("#{char}method")
436
- child[:example_group][:full_description].should eq("Array with 2 items #{char}method")
436
+ expect(child[:example_group][:full_description]).to eq("Array with 2 items #{char}method")
437
437
  end
438
438
  end
439
439
  end
@@ -446,7 +446,7 @@ module RSpec
446
446
  "./lib/rspec/core/foo.rb",
447
447
  "#{__FILE__}:#{__LINE__}"
448
448
  ])
449
- m[:example_group][:file_path].should eq(relative_path(__FILE__))
449
+ expect(m[:example_group][:file_path]).to eq(relative_path(__FILE__))
450
450
  end
451
451
  end
452
452
 
@@ -454,19 +454,19 @@ module RSpec
454
454
  it "finds the line number with the first non-rspec lib file in the backtrace" do
455
455
  m = Metadata.new
456
456
  m.process({})
457
- m[:example_group][:line_number].should eq(__LINE__ - 1)
457
+ expect(m[:example_group][:line_number]).to eq(__LINE__ - 1)
458
458
  end
459
459
 
460
460
  it "finds the line number with the first spec file with drive letter" do
461
461
  m = Metadata.new
462
462
  m.process(:caller => [ "C:/path/to/file_spec.rb:#{__LINE__}" ])
463
- m[:example_group][:line_number].should eq(__LINE__ - 1)
463
+ expect(m[:example_group][:line_number]).to eq(__LINE__ - 1)
464
464
  end
465
465
 
466
466
  it "uses the number after the first : for ruby 1.9" do
467
467
  m = Metadata.new
468
468
  m.process(:caller => [ "#{__FILE__}:#{__LINE__}:999" ])
469
- m[:example_group][:line_number].should eq(__LINE__ - 1)
469
+ expect(m[:example_group][:line_number]).to eq(__LINE__ - 1)
470
470
  end
471
471
  end
472
472
 
@@ -478,7 +478,7 @@ module RSpec
478
478
  child = Metadata.new(parent)
479
479
  child.process()
480
480
 
481
- child[:example_group][:example_group].should eq(parent[:example_group])
481
+ expect(child[:example_group][:example_group]).to eq(parent[:example_group])
482
482
  end
483
483
  end
484
484
  end
@@ -34,21 +34,21 @@ module RSpec::Core
34
34
 
35
35
  it "gets converted to --format" do
36
36
  options = Parser.parse!(%w[--formatter doc])
37
- options[:formatters].first.should eq(["doc"])
37
+ expect(options[:formatters].first).to eq(["doc"])
38
38
  end
39
39
  end
40
40
 
41
41
  describe "--default_path" do
42
42
  it "gets converted to --default-path" do
43
43
  options = Parser.parse!(%w[--default_path foo])
44
- options[:default_path].should == "foo"
44
+ expect(options[:default_path]).to eq "foo"
45
45
  end
46
46
  end
47
47
 
48
48
  describe "--line_number" do
49
49
  it "gets converted to --line-number" do
50
50
  options = Parser.parse!(%w[--line_number 3])
51
- options[:line_numbers].should == ["3"]
51
+ expect(options[:line_numbers]).to eq ["3"]
52
52
  end
53
53
  end
54
54
 
@@ -56,7 +56,7 @@ module RSpec::Core
56
56
  describe "--default-path" do
57
57
  it "sets the default path where RSpec looks for examples" do
58
58
  options = Parser.parse!(%w[--default-path foo])
59
- options[:default_path].should == "foo"
59
+ expect(options[:default_path]).to eq "foo"
60
60
  end
61
61
  end
62
62
 
@@ -64,7 +64,7 @@ module RSpec::Core
64
64
  describe option do
65
65
  it "sets the line number of an example to run" do
66
66
  options = Parser.parse!([option, "3"])
67
- options[:line_numbers].should == ["3"]
67
+ expect(options[:line_numbers]).to eq ["3"]
68
68
  end
69
69
  end
70
70
  end
@@ -73,7 +73,7 @@ module RSpec::Core
73
73
  describe option do
74
74
  it "defines the formatter" do
75
75
  options = Parser.parse!([option, 'doc'])
76
- options[:formatters].first.should eq(["doc"])
76
+ expect(options[:formatters].first).to eq(["doc"])
77
77
  end
78
78
  end
79
79
  end
@@ -83,23 +83,23 @@ module RSpec::Core
83
83
  let(:options) { Parser.parse!([option, 'out.txt']) }
84
84
 
85
85
  it "sets the output stream for the formatter" do
86
- options[:formatters].last.should eq(['progress', 'out.txt'])
86
+ expect(options[:formatters].last).to eq(['progress', 'out.txt'])
87
87
  end
88
88
 
89
89
  context "with multiple formatters" do
90
90
  context "after last formatter" do
91
91
  it "sets the output stream for the last formatter" do
92
92
  options = Parser.parse!(['-f', 'progress', '-f', 'doc', option, 'out.txt'])
93
- options[:formatters][0].should eq(['progress'])
94
- options[:formatters][1].should eq(['doc', 'out.txt'])
93
+ expect(options[:formatters][0]).to eq(['progress'])
94
+ expect(options[:formatters][1]).to eq(['doc', 'out.txt'])
95
95
  end
96
96
  end
97
97
 
98
98
  context "after first formatter" do
99
99
  it "sets the output stream for the first formatter" do
100
100
  options = Parser.parse!(['-f', 'progress', option, 'out.txt', '-f', 'doc'])
101
- options[:formatters][0].should eq(['progress', 'out.txt'])
102
- options[:formatters][1].should eq(['doc'])
101
+ expect(options[:formatters][0]).to eq(['progress', 'out.txt'])
102
+ expect(options[:formatters][1]).to eq(['doc'])
103
103
  end
104
104
  end
105
105
  end
@@ -110,8 +110,8 @@ module RSpec::Core
110
110
  describe option do
111
111
  it "escapes the arg" do
112
112
  options = Parser.parse!([option, "this (and that)"])
113
- options[:full_description].length.should eq(1)
114
- "this (and that)".should match(options[:full_description].first)
113
+ expect(options[:full_description].length).to eq(1)
114
+ expect("this (and that)").to match(options[:full_description].first)
115
115
  end
116
116
  end
117
117
  end
@@ -120,7 +120,7 @@ module RSpec::Core
120
120
  describe option do
121
121
  it "sets the filename pattern" do
122
122
  options = Parser.parse!([option, 'spec/**/*.spec'])
123
- options[:pattern].should eq('spec/**/*.spec')
123
+ expect(options[:pattern]).to eq('spec/**/*.spec')
124
124
  end
125
125
  end
126
126
  end
@@ -130,54 +130,54 @@ module RSpec::Core
130
130
  context "without ~" do
131
131
  it "treats no value as true" do
132
132
  options = Parser.parse!([option, 'foo'])
133
- options[:inclusion_filter].should eq(:foo => true)
133
+ expect(options[:inclusion_filter]).to eq(:foo => true)
134
134
  end
135
135
 
136
136
  it "treats 'true' as true" do
137
137
  options = Parser.parse!([option, 'foo:true'])
138
- options[:inclusion_filter].should eq(:foo => true)
138
+ expect(options[:inclusion_filter]).to eq(:foo => true)
139
139
  end
140
140
 
141
141
  it "treats 'nil' as nil" do
142
142
  options = Parser.parse!([option, 'foo:nil'])
143
- options[:inclusion_filter].should eq(:foo => nil)
143
+ expect(options[:inclusion_filter]).to eq(:foo => nil)
144
144
  end
145
145
 
146
146
  it "treats 'false' as false" do
147
147
  options = Parser.parse!([option, 'foo:false'])
148
- options[:inclusion_filter].should eq(:foo => false)
148
+ expect(options[:inclusion_filter]).to eq(:foo => false)
149
149
  end
150
150
 
151
151
  it "merges muliple invocations" do
152
152
  options = Parser.parse!([option, 'foo:false', option, 'bar:true', option, 'foo:true'])
153
- options[:inclusion_filter].should eq(:foo => true, :bar => true)
153
+ expect(options[:inclusion_filter]).to eq(:foo => true, :bar => true)
154
154
  end
155
155
 
156
156
  it "treats 'any_string' as 'any_string'" do
157
157
  options = Parser.parse!([option, 'foo:any_string'])
158
- options[:inclusion_filter].should eq(:foo => 'any_string')
158
+ expect(options[:inclusion_filter]).to eq(:foo => 'any_string')
159
159
  end
160
160
  end
161
161
 
162
162
  context "with ~" do
163
163
  it "treats no value as true" do
164
164
  options = Parser.parse!([option, '~foo'])
165
- options[:exclusion_filter].should eq(:foo => true)
165
+ expect(options[:exclusion_filter]).to eq(:foo => true)
166
166
  end
167
167
 
168
168
  it "treats 'true' as true" do
169
169
  options = Parser.parse!([option, '~foo:true'])
170
- options[:exclusion_filter].should eq(:foo => true)
170
+ expect(options[:exclusion_filter]).to eq(:foo => true)
171
171
  end
172
172
 
173
173
  it "treats 'nil' as nil" do
174
174
  options = Parser.parse!([option, '~foo:nil'])
175
- options[:exclusion_filter].should eq(:foo => nil)
175
+ expect(options[:exclusion_filter]).to eq(:foo => nil)
176
176
  end
177
177
 
178
178
  it "treats 'false' as false" do
179
179
  options = Parser.parse!([option, '~foo:false'])
180
- options[:exclusion_filter].should eq(:foo => false)
180
+ expect(options[:exclusion_filter]).to eq(:foo => false)
181
181
  end
182
182
  end
183
183
  end
@@ -185,14 +185,14 @@ module RSpec::Core
185
185
 
186
186
  describe "--order" do
187
187
  it "is nil by default" do
188
- Parser.parse!([])[:order].should be_nil
188
+ expect(Parser.parse!([])[:order]).to be_nil
189
189
  end
190
190
 
191
191
  %w[rand random].each do |option|
192
192
  context "with #{option}" do
193
193
  it "defines the order as random" do
194
194
  options = Parser.parse!(['--order', option])
195
- options[:order].should eq(option)
195
+ expect(options[:order]).to eq(option)
196
196
  end
197
197
  end
198
198
  end
@@ -201,7 +201,7 @@ module RSpec::Core
201
201
  describe "--seed" do
202
202
  it "sets the order to rand:SEED" do
203
203
  options = Parser.parse!(%w[--seed 123])
204
- options[:order].should eq("rand:123")
204
+ expect(options[:order]).to eq("rand:123")
205
205
  end
206
206
  end
207
207
  end