rspec-core 2.99.2 → 3.0.0.beta1

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 (165) hide show
  1. checksums.yaml +14 -6
  2. checksums.yaml.gz.sig +2 -0
  3. data.tar.gz.sig +0 -0
  4. data/Changelog.md +103 -191
  5. data/License.txt +1 -0
  6. data/README.md +4 -25
  7. data/features/Upgrade.md +2 -14
  8. data/features/command_line/dry_run.feature +29 -0
  9. data/features/command_line/example_name_option.feature +1 -1
  10. data/features/command_line/fail_fast.feature +26 -0
  11. data/features/command_line/format_option.feature +3 -3
  12. data/features/command_line/line_number_option.feature +16 -11
  13. data/features/command_line/order.feature +2 -3
  14. data/features/command_line/pattern_option.feature +3 -3
  15. data/features/command_line/randomization.feature +63 -0
  16. data/features/command_line/require_option.feature +2 -2
  17. data/features/command_line/ruby.feature +1 -1
  18. data/features/configuration/alias_example_to.feature +13 -22
  19. data/features/configuration/{backtrace_clean_patterns.feature → backtrace_exclusion_patterns.feature} +17 -14
  20. data/features/configuration/custom_settings.feature +11 -11
  21. data/features/configuration/overriding_global_ordering.feature +93 -0
  22. data/features/configuration/profile.feature +13 -13
  23. data/features/configuration/read_options_from_file.feature +7 -7
  24. data/features/example_groups/basic_structure.feature +1 -1
  25. data/features/example_groups/shared_context.feature +8 -8
  26. data/features/example_groups/shared_examples.feature +6 -14
  27. data/features/expectation_framework_integration/configure_expectation_framework.feature +27 -122
  28. data/features/filtering/exclusion_filters.feature +2 -5
  29. data/features/filtering/inclusion_filters.feature +1 -5
  30. data/features/formatters/json_formatter.feature +2 -2
  31. data/features/formatters/text_formatter.feature +4 -4
  32. data/features/helper_methods/arbitrary_methods.feature +2 -2
  33. data/features/helper_methods/let.feature +5 -5
  34. data/features/helper_methods/modules.feature +5 -8
  35. data/features/hooks/around_hooks.feature +2 -2
  36. data/features/hooks/before_and_after_hooks.feature +14 -14
  37. data/features/hooks/filtering.feature +12 -14
  38. data/features/metadata/described_class.feature +1 -1
  39. data/features/metadata/user_defined.feature +16 -29
  40. data/features/mock_framework_integration/use_flexmock.feature +1 -1
  41. data/features/mock_framework_integration/use_mocha.feature +1 -1
  42. data/features/mock_framework_integration/use_rr.feature +1 -1
  43. data/features/mock_framework_integration/use_rspec.feature +5 -5
  44. data/features/pending/pending_examples.feature +5 -5
  45. data/features/spec_files/arbitrary_file_suffix.feature +1 -1
  46. data/features/step_definitions/additional_cli_steps.rb +3 -3
  47. data/features/subject/explicit_subject.feature +8 -8
  48. data/features/subject/implicit_receiver.feature +29 -0
  49. data/features/subject/implicit_subject.feature +4 -4
  50. data/features/support/env.rb +10 -3
  51. data/features/support/require_expect_syntax_in_aruba_specs.rb +16 -0
  52. data/lib/rspec/core.rb +11 -48
  53. data/lib/rspec/core/backport_random.rb +302 -0
  54. data/lib/rspec/core/backtrace_formatter.rb +65 -0
  55. data/lib/rspec/core/command_line.rb +7 -18
  56. data/lib/rspec/core/configuration.rb +202 -507
  57. data/lib/rspec/core/configuration_options.rb +17 -30
  58. data/lib/rspec/core/example.rb +29 -39
  59. data/lib/rspec/core/example_group.rb +166 -259
  60. data/lib/rspec/core/filter_manager.rb +30 -47
  61. data/lib/rspec/core/flat_map.rb +17 -0
  62. data/lib/rspec/core/formatters.rb +0 -138
  63. data/lib/rspec/core/formatters/base_formatter.rb +46 -1
  64. data/lib/rspec/core/formatters/base_text_formatter.rb +38 -61
  65. data/lib/rspec/core/formatters/deprecation_formatter.rb +21 -52
  66. data/lib/rspec/core/formatters/helpers.rb +0 -28
  67. data/lib/rspec/core/formatters/html_formatter.rb +1 -1
  68. data/lib/rspec/core/formatters/json_formatter.rb +38 -9
  69. data/lib/rspec/core/formatters/snippet_extractor.rb +14 -5
  70. data/lib/rspec/core/hooks.rb +55 -39
  71. data/lib/rspec/core/memoized_helpers.rb +17 -167
  72. data/lib/rspec/core/metadata.rb +16 -64
  73. data/lib/rspec/core/option_parser.rb +30 -39
  74. data/lib/rspec/core/ordering.rb +154 -0
  75. data/lib/rspec/core/pending.rb +12 -69
  76. data/lib/rspec/core/project_initializer.rb +12 -10
  77. data/lib/rspec/core/rake_task.rb +5 -108
  78. data/lib/rspec/core/reporter.rb +15 -18
  79. data/lib/rspec/core/runner.rb +16 -30
  80. data/lib/rspec/core/shared_context.rb +3 -5
  81. data/lib/rspec/core/shared_example_group.rb +3 -51
  82. data/lib/rspec/core/shared_example_group/collection.rb +1 -19
  83. data/lib/rspec/core/version.rb +1 -1
  84. data/lib/rspec/core/warnings.rb +22 -0
  85. data/lib/rspec/core/world.rb +12 -8
  86. data/spec/command_line/order_spec.rb +20 -23
  87. data/spec/rspec/core/backtrace_formatter_spec.rb +216 -0
  88. data/spec/rspec/core/command_line_spec.rb +32 -48
  89. data/spec/rspec/core/configuration_options_spec.rb +19 -50
  90. data/spec/rspec/core/configuration_spec.rb +142 -713
  91. data/spec/rspec/core/drb_command_line_spec.rb +2 -0
  92. data/spec/rspec/core/dsl_spec.rb +0 -1
  93. data/spec/rspec/core/example_group_spec.rb +192 -223
  94. data/spec/rspec/core/example_spec.rb +40 -16
  95. data/spec/rspec/core/filter_manager_spec.rb +2 -2
  96. data/spec/rspec/core/formatters/base_formatter_spec.rb +0 -41
  97. data/spec/rspec/core/formatters/base_text_formatter_spec.rb +5 -123
  98. data/spec/rspec/core/formatters/deprecation_formatter_spec.rb +2 -87
  99. data/spec/rspec/core/formatters/documentation_formatter_spec.rb +2 -3
  100. data/spec/rspec/core/formatters/{text_mate_formatted.html → html_formatted-1.8.7-jruby.html} +44 -25
  101. data/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html +477 -0
  102. data/spec/rspec/core/formatters/{html_formatted.html → html_formatted-1.8.7.html} +42 -25
  103. data/spec/rspec/core/formatters/html_formatted-1.9.2.html +425 -0
  104. data/spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html +416 -0
  105. data/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html +477 -0
  106. data/spec/rspec/core/formatters/html_formatted-1.9.3.html +419 -0
  107. data/spec/rspec/core/formatters/html_formatted-2.0.0.html +425 -0
  108. data/spec/rspec/core/formatters/html_formatter_spec.rb +21 -46
  109. data/spec/rspec/core/formatters/json_formatter_spec.rb +97 -8
  110. data/spec/rspec/core/hooks_filtering_spec.rb +5 -5
  111. data/spec/rspec/core/hooks_spec.rb +61 -47
  112. data/spec/rspec/core/memoized_helpers_spec.rb +20 -322
  113. data/spec/rspec/core/metadata_spec.rb +1 -24
  114. data/spec/rspec/core/option_parser_spec.rb +20 -62
  115. data/spec/rspec/core/ordering_spec.rb +102 -0
  116. data/spec/rspec/core/pending_example_spec.rb +0 -40
  117. data/spec/rspec/core/project_initializer_spec.rb +1 -25
  118. data/spec/rspec/core/rake_task_spec.rb +5 -72
  119. data/spec/rspec/core/random_spec.rb +47 -0
  120. data/spec/rspec/core/reporter_spec.rb +23 -48
  121. data/spec/rspec/core/runner_spec.rb +31 -39
  122. data/spec/rspec/core/shared_context_spec.rb +3 -15
  123. data/spec/rspec/core/shared_example_group/collection_spec.rb +4 -17
  124. data/spec/rspec/core/shared_example_group_spec.rb +12 -45
  125. data/spec/rspec/core/{deprecation_spec.rb → warnings_spec.rb} +3 -1
  126. data/spec/rspec/core_spec.rb +4 -21
  127. data/spec/spec_helper.rb +41 -5
  128. data/spec/support/helper_methods.rb +0 -29
  129. data/spec/support/sandboxed_mock_space.rb +0 -16
  130. data/spec/support/shared_example_groups.rb +7 -36
  131. data/spec/support/stderr_splitter.rb +36 -0
  132. metadata +163 -157
  133. metadata.gz.sig +1 -0
  134. data/exe/autospec +0 -13
  135. data/features/Autotest.md +0 -38
  136. data/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature +0 -52
  137. data/features/subject/attribute_of_subject.feature +0 -124
  138. data/features/subject/one_liner_syntax.feature +0 -71
  139. data/lib/autotest/discover.rb +0 -10
  140. data/lib/autotest/rspec2.rb +0 -77
  141. data/lib/rspec/core/backtrace_cleaner.rb +0 -46
  142. data/lib/rspec/core/backward_compatibility.rb +0 -55
  143. data/lib/rspec/core/caller_filter.rb +0 -60
  144. data/lib/rspec/core/deprecated_mutable_array_proxy.rb +0 -32
  145. data/lib/rspec/core/deprecation.rb +0 -26
  146. data/lib/rspec/core/extensions/instance_eval_with_args.rb +0 -44
  147. data/lib/rspec/core/extensions/kernel.rb +0 -9
  148. data/lib/rspec/core/extensions/module_eval_with_args.rb +0 -38
  149. data/lib/rspec/core/extensions/ordered.rb +0 -27
  150. data/lib/rspec/core/formatters/console_codes.rb +0 -42
  151. data/lib/rspec/core/formatters/text_mate_formatter.rb +0 -34
  152. data/lib/rspec/core/metadata_hash_builder.rb +0 -97
  153. data/lib/rspec/core/minitest_assertions_adapter.rb +0 -28
  154. data/lib/rspec/core/test_unit_assertions_adapter.rb +0 -30
  155. data/spec/autotest/discover_spec.rb +0 -49
  156. data/spec/autotest/failed_results_re_spec.rb +0 -45
  157. data/spec/autotest/rspec_spec.rb +0 -133
  158. data/spec/rspec/core/backtrace_cleaner_spec.rb +0 -68
  159. data/spec/rspec/core/caller_filter_spec.rb +0 -58
  160. data/spec/rspec/core/deprecations_spec.rb +0 -59
  161. data/spec/rspec/core/formatters/console_codes_spec.rb +0 -50
  162. data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +0 -107
  163. data/spec/rspec/core/kernel_extensions_spec.rb +0 -9
  164. data/spec/rspec/core/pending_spec.rb +0 -27
  165. data/spec/support/silence_dsl_deprecations.rb +0 -32
@@ -1,10 +1,8 @@
1
1
  Feature: exclusion filters
2
2
 
3
3
  You can exclude examples from a run by declaring an exclusion filter and
4
- then tagging examples, or entire groups, with that filter.
5
-
6
- If you set the `treat_symbols_as_metadata_keys_with_true_values` config option
7
- to `true`, you can specify metadata using only symbols.
4
+ then tagging examples, or entire groups, with that filter. You can also
5
+ specify metadata using only symbols.
8
6
 
9
7
  Scenario: exclude an example
10
8
  Given a file named "spec/sample_spec.rb" with:
@@ -120,7 +118,6 @@ Feature: exclusion filters
120
118
  Given a file named "symbols_as_metadata_spec.rb" with:
121
119
  """ruby
122
120
  RSpec.configure do |c|
123
- c.treat_symbols_as_metadata_keys_with_true_values = true
124
121
  c.filter_run_excluding :broken
125
122
  end
126
123
 
@@ -2,10 +2,7 @@ Feature: inclusion filters
2
2
 
3
3
  You can constrain which examples are run by declaring an inclusion filter. The
4
4
  most common use case is to focus on a subset of examples as you're focused on
5
- a particular problem.
6
-
7
- You can specify metadata using only symbols if you set the
8
- `treat_symbols_as_metadata_keys_with_true_values` config option to `true`.
5
+ a particular problem. You can also specify metadata using only symbols.
9
6
 
10
7
  Background:
11
8
  Given a file named "spec/spec_helper.rb" with:
@@ -88,7 +85,6 @@ Feature: inclusion filters
88
85
  Given a file named "symbols_as_metadata_spec.rb" with:
89
86
  """ruby
90
87
  RSpec.configure do |c|
91
- c.treat_symbols_as_metadata_keys_with_true_values = true
92
88
  c.filter_run :current_example
93
89
  end
94
90
 
@@ -5,11 +5,11 @@ Feature: JSON formatter
5
5
  """ruby
6
6
  describe "Various" do
7
7
  it "fails" do
8
- "fail".should eq("succeed")
8
+ expect("fail").to eq("succeed")
9
9
  end
10
10
 
11
11
  it "succeeds" do
12
- "succeed".should eq("succeed")
12
+ expect("succeed").to eq("succeed")
13
13
  end
14
14
 
15
15
  it "pends"
@@ -9,7 +9,7 @@ Feature: text formatter
9
9
  """ruby
10
10
  describe String do
11
11
  it "has a failing example" do
12
- "foo".reverse.should eq("ofo")
12
+ expect("foo".reverse).to eq("ofo")
13
13
  end
14
14
  end
15
15
  """
@@ -17,7 +17,7 @@ Feature: text formatter
17
17
  """ruby
18
18
  describe Integer do
19
19
  it "has a failing example" do
20
- (7 + 5).should eq(11)
20
+ expect(7 + 5).to eq(11)
21
21
  end
22
22
  end
23
23
  """
@@ -25,7 +25,7 @@ Feature: text formatter
25
25
  Then the backtrace-normalized output should contain:
26
26
  """
27
27
  1) Integer has a failing example
28
- Failure/Error: (7 + 5).should eq(11)
28
+ Failure/Error: expect(7 + 5).to eq(11)
29
29
 
30
30
  expected: 11
31
31
  got: 12
@@ -36,7 +36,7 @@ Feature: text formatter
36
36
  And the backtrace-normalized output should contain:
37
37
  """
38
38
  2) String has a failing example
39
- Failure/Error: "foo".reverse.should eq("ofo")
39
+ Failure/Error: expect("foo".reverse).to eq("ofo")
40
40
 
41
41
  expected: "ofo"
42
42
  got: "oof"
@@ -14,7 +14,7 @@ Feature: arbitrary helper methods
14
14
  end
15
15
 
16
16
  it "has access to methods defined in its group" do
17
- help.should be(:available)
17
+ expect(help).to be(:available)
18
18
  end
19
19
  end
20
20
  """
@@ -31,7 +31,7 @@ Feature: arbitrary helper methods
31
31
 
32
32
  describe "in a nested group" do
33
33
  it "has access to methods defined in its parent group" do
34
- help.should be(:available)
34
+ expect(help).to be(:available)
35
35
  end
36
36
  end
37
37
  end
@@ -15,12 +15,12 @@ Feature: let and let!
15
15
  let(:count) { $count += 1 }
16
16
 
17
17
  it "memoizes the value" do
18
- count.should eq(1)
19
- count.should eq(1)
18
+ expect(count).to eq(1)
19
+ expect(count).to eq(1)
20
20
  end
21
21
 
22
22
  it "is not cached across examples" do
23
- count.should eq(2)
23
+ expect(count).to eq(2)
24
24
  end
25
25
  end
26
26
  """
@@ -41,8 +41,8 @@ Feature: let and let!
41
41
 
42
42
  it "calls the helper method in a before hook" do
43
43
  invocation_order << :example
44
- invocation_order.should == [:let!, :example]
45
- count.should eq(1)
44
+ expect(invocation_order).to eq([:let!, :example])
45
+ expect(count).to eq(1)
46
46
  end
47
47
  end
48
48
  """
@@ -8,10 +8,8 @@ Feature: Define helper methods in a module
8
8
 
9
9
  You can also include or extend the module onto only certain example
10
10
  groups by passing a metadata hash as the last argument. Only groups
11
- that match the given metadata will include or extend the module.
12
-
13
- If you set the `treat_symbols_as_metadata_keys_with_true_values` config option
14
- to `true`, you can specify metadata using only symbols.
11
+ that match the given metadata will include or extend the module. You
12
+ can also specify metadata using only symbols.
15
13
 
16
14
  Background:
17
15
  Given a file named "helpers.rb" with:
@@ -34,7 +32,7 @@ Feature: Define helper methods in a module
34
32
 
35
33
  describe "an example group" do
36
34
  it "has access to the helper methods defined in the module" do
37
- help.should be(:available)
35
+ expect(help).to be(:available)
38
36
  end
39
37
  end
40
38
  """
@@ -73,7 +71,7 @@ Feature: Define helper methods in a module
73
71
 
74
72
  describe "an example group with matching metadata", :foo => :bar do
75
73
  it "has access to the helper methods defined in the module" do
76
- help.should be(:available)
74
+ expect(help).to be(:available)
77
75
  end
78
76
  end
79
77
 
@@ -122,7 +120,6 @@ Feature: Define helper methods in a module
122
120
  require './helpers'
123
121
 
124
122
  RSpec.configure do |c|
125
- c.treat_symbols_as_metadata_keys_with_true_values = true
126
123
  c.include Helpers, :include_helpers
127
124
  c.extend Helpers, :extend_helpers
128
125
  end
@@ -131,7 +128,7 @@ Feature: Define helper methods in a module
131
128
  puts "In a group not matching the extend filter, help is #{help rescue 'not available'}"
132
129
 
133
130
  it "has access to the helper methods defined in the module" do
134
- help.should be(:available)
131
+ expect(help).to be(:available)
135
132
  end
136
133
  end
137
134
 
@@ -192,7 +192,7 @@ Feature: around hooks
192
192
  end
193
193
 
194
194
  it "runs the example in the correct context" do
195
- included_in_configure_block.should be_truthy
195
+ expect(included_in_configure_block).to be_truthy
196
196
  end
197
197
  end
198
198
  """
@@ -259,7 +259,7 @@ Feature: around hooks
259
259
 
260
260
  it "they should all be run" do
261
261
  puts "in the example"
262
- 1.should eq(1)
262
+ expect(1).to eq(1)
263
263
  end
264
264
  end
265
265
  """
@@ -43,7 +43,7 @@ Feature: before and after hooks
43
43
 
44
44
  describe "initialized in before(:each)" do
45
45
  it "has 0 widgets" do
46
- @thing.should have(0).widgets
46
+ expect(@thing.widgets.count).to eq(0)
47
47
  end
48
48
 
49
49
  it "can get accept new widgets" do
@@ -51,7 +51,7 @@ Feature: before and after hooks
51
51
  end
52
52
 
53
53
  it "does not share state across examples" do
54
- @thing.should have(0).widgets
54
+ expect(@thing.widgets.count).to eq(0)
55
55
  end
56
56
  end
57
57
  end
@@ -77,7 +77,7 @@ Feature: before and after hooks
77
77
 
78
78
  describe "initialized in before(:all)" do
79
79
  it "has 0 widgets" do
80
- @thing.should have(0).widgets
80
+ expect(@thing.widgets.count).to eq(0)
81
81
  end
82
82
 
83
83
  it "can get accept new widgets" do
@@ -85,7 +85,7 @@ Feature: before and after hooks
85
85
  end
86
86
 
87
87
  it "shares state across examples" do
88
- @thing.should have(1).widgets
88
+ expect(@thing.widgets.count).to eq(1)
89
89
  end
90
90
  end
91
91
  end
@@ -191,12 +191,12 @@ Feature: before and after hooks
191
191
  describe "stuff in before blocks" do
192
192
  describe "with :all" do
193
193
  it "should be available in the example" do
194
- @before_all.should eq("before all")
194
+ expect(@before_all).to eq("before all")
195
195
  end
196
196
  end
197
197
  describe "with :each" do
198
198
  it "should be available in the example" do
199
- @before_each.should eq("before each")
199
+ expect(@before_each).to eq("before each")
200
200
  end
201
201
  end
202
202
  end
@@ -355,19 +355,19 @@ Feature: before and after hooks
355
355
 
356
356
  describe "nested" do
357
357
  it "access state set in before(:all)" do
358
- @value.should eq(123)
358
+ expect(@value).to eq(123)
359
359
  end
360
360
 
361
361
  describe "nested more deeply" do
362
362
  it "access state set in before(:all)" do
363
- @value.should eq(123)
363
+ expect(@value).to eq(123)
364
364
  end
365
365
  end
366
366
  end
367
367
 
368
368
  describe "nested in parallel" do
369
369
  it "access state set in before(:all)" do
370
- @value.should eq(123)
370
+ expect(@value).to eq(123)
371
371
  end
372
372
  end
373
373
  end
@@ -384,7 +384,7 @@ Feature: before and after hooks
384
384
  end
385
385
 
386
386
  example "in outer group" do
387
- @outer_state.should eq("set in outer before all")
387
+ expect(@outer_state).to eq("set in outer before all")
388
388
  end
389
389
 
390
390
  describe "nested group" do
@@ -393,17 +393,17 @@ Feature: before and after hooks
393
393
  end
394
394
 
395
395
  example "in nested group" do
396
- @outer_state.should eq("set in outer before all")
397
- @inner_state.should eq("set in inner before all")
396
+ expect(@outer_state).to eq("set in outer before all")
397
+ expect(@inner_state).to eq("set in inner before all")
398
398
  end
399
399
 
400
400
  after(:all) do
401
- @inner_state.should eq("set in inner before all")
401
+ expect(@inner_state).to eq("set in inner before all")
402
402
  end
403
403
  end
404
404
 
405
405
  after(:all) do
406
- @outer_state.should eq("set in outer before all")
406
+ expect(@outer_state).to eq("set in outer before all")
407
407
  end
408
408
  end
409
409
  """
@@ -12,8 +12,7 @@ Feature: filters
12
12
  describe "something", :type => :model do
13
13
  end
14
14
 
15
- You can specify metadata using only symbols if you set the
16
- `treat_symbols_as_metadata_keys_with_true_values` config option to `true`.
15
+ You can also specify metadata using only symbols.
17
16
 
18
17
  Scenario: filter `before(:each)` hooks using arbitrary metadata
19
18
  Given a file named "filter_before_each_hooks_spec.rb" with:
@@ -29,17 +28,17 @@ Feature: filters
29
28
 
30
29
  describe "group without matching metadata" do
31
30
  it "does not run the hook" do
32
- invoked_hooks.should be_empty
31
+ expect(invoked_hooks).to be_empty
33
32
  end
34
33
 
35
34
  it "runs the hook for an example with matching metadata", :foo => :bar do
36
- invoked_hooks.should == [:before_each_foo_bar]
35
+ expect(invoked_hooks).to eq([:before_each_foo_bar])
37
36
  end
38
37
  end
39
38
 
40
39
  describe "group with matching metadata", :foo => :bar do
41
40
  it "runs the hook" do
42
- invoked_hooks.should == [:before_each_foo_bar]
41
+ expect(invoked_hooks).to eq([:before_each_foo_bar])
43
42
  end
44
43
  end
45
44
  end
@@ -84,7 +83,7 @@ Feature: filters
84
83
  config.around(:each, :foo => :bar) do |example|
85
84
  order << :before_around_each_foo_bar
86
85
  example.run
87
- order.should == [:before_around_each_foo_bar, :example]
86
+ expect(order).to eq([:before_around_each_foo_bar, :example])
88
87
  end
89
88
  end
90
89
 
@@ -93,18 +92,18 @@ Feature: filters
93
92
 
94
93
  describe "a group without matching metadata" do
95
94
  it "does not run the hook" do
96
- order.should be_empty
95
+ expect(order).to be_empty
97
96
  end
98
97
 
99
98
  it "runs the hook for an example with matching metadata", :foo => :bar do
100
- order.should == [:before_around_each_foo_bar]
99
+ expect(order).to eq([:before_around_each_foo_bar])
101
100
  order << :example
102
101
  end
103
102
  end
104
103
 
105
104
  describe "a group with matching metadata", :foo => :bar do
106
105
  it "runs the hook for an example with matching metadata", :foo => :bar do
107
- order.should == [:before_around_each_foo_bar]
106
+ expect(order).to eq([:before_around_each_foo_bar])
108
107
  order << :example
109
108
  end
110
109
  end
@@ -123,24 +122,24 @@ Feature: filters
123
122
  describe "a filtered before(:all) hook" do
124
123
  describe "a group without matching metadata" do
125
124
  it "does not run the hook" do
126
- @hook.should be_nil
125
+ expect(@hook).to be_nil
127
126
  end
128
127
 
129
128
  describe "a nested subgroup with matching metadata", :foo => :bar do
130
129
  it "runs the hook" do
131
- @hook.should == :before_all_foo_bar
130
+ expect(@hook).to eq(:before_all_foo_bar)
132
131
  end
133
132
  end
134
133
  end
135
134
 
136
135
  describe "a group with matching metadata", :foo => :bar do
137
136
  it "runs the hook" do
138
- @hook.should == :before_all_foo_bar
137
+ expect(@hook).to eq(:before_all_foo_bar)
139
138
  end
140
139
 
141
140
  describe "a nested subgroup" do
142
141
  it "runs the hook" do
143
- @hook.should == :before_all_foo_bar
142
+ expect(@hook).to eq(:before_all_foo_bar)
144
143
  end
145
144
  end
146
145
  end
@@ -197,7 +196,6 @@ Feature: filters
197
196
  Given a file named "less_verbose_metadata_filter.rb" with:
198
197
  """ruby
199
198
  RSpec.configure do |c|
200
- c.treat_symbols_as_metadata_keys_with_true_values = true
201
199
  c.before(:each, :before_each) { puts "before each" }
202
200
  c.after(:each, :after_each) { puts "after each" }
203
201
  c.around(:each, :around_each) do |example|
@@ -8,7 +8,7 @@ Feature: described class
8
8
  """ruby
9
9
  describe Fixnum do
10
10
  it "is available as described_class" do
11
- described_class.should eq(Fixnum)
11
+ expect(described_class).to eq(Fixnum)
12
12
  end
13
13
  end
14
14
  """
@@ -8,16 +8,7 @@ Feature: User-defined metadata
8
8
  Metadata defined on an example group is available (and can be overridden)
9
9
  by any sub-group or from any example in that group or a sub-group.
10
10
 
11
- In addition, there is a configuration option (which will be the default
12
- behavior in RSpec 3) that allows you to specify metadata using just
13
- symbols:
14
-
15
- ```ruby
16
- RSpec.configure do |c|
17
- c.treat_symbols_as_metadata_keys_with_true_values = true
18
- end
19
- ```
20
-
11
+ In addition, you can specify metdata using just symbols.
21
12
  Each symbol passed as an argument to `describe`, `context` or `it` will
22
13
  be a key in the metadata hash, with a corresponding value of `true`.
23
14
 
@@ -26,20 +17,20 @@ Feature: User-defined metadata
26
17
  """ruby
27
18
  describe "a group with user-defined metadata", :foo => 17 do
28
19
  it 'has access to the metadata in the example' do |example|
29
- example.metadata[:foo].should eq(17)
20
+ expect(example.metadata[:foo]).to eq(17)
30
21
  end
31
22
 
32
23
  it 'does not have access to metadata defined on sub-groups' do |example|
33
- example.metadata.should_not include(:bar)
24
+ expect(example.metadata).not_to include(:bar)
34
25
  end
35
26
 
36
27
  describe 'a sub-group with user-defined metadata', :bar => 12 do
37
28
  it 'has access to the sub-group metadata' do |example|
38
- example.metadata[:foo].should eq(17)
29
+ expect(example.metadata[:foo]).to eq(17)
39
30
  end
40
31
 
41
32
  it 'also has access to metadata defined on parent groups' do |example|
42
- example.metadata[:bar].should eq(12)
33
+ expect(example.metadata[:bar]).to eq(12)
43
34
  end
44
35
  end
45
36
  end
@@ -52,14 +43,14 @@ Feature: User-defined metadata
52
43
  """ruby
53
44
  describe "a group with no user-defined metadata" do
54
45
  it 'has an example with metadata', :foo => 17 do |example|
55
- example.metadata[:foo].should eq(17)
56
- example.metadata.should_not include(:bar)
46
+ expect(example.metadata[:foo]).to eq(17)
47
+ expect(example.metadata).not_to include(:bar)
57
48
  end
58
49
 
59
50
  it 'has another example with metadata', :bar => 12, :bazz => 33 do |example|
60
- example.metadata[:bar].should eq(12)
61
- example.metadata[:bazz].should eq(33)
62
- example.metadata.should_not include(:foo)
51
+ expect(example.metadata[:bar]).to eq(12)
52
+ expect(example.metadata[:bazz]).to eq(33)
53
+ expect(example.metadata).not_to include(:foo)
63
54
  end
64
55
  end
65
56
  """
@@ -71,12 +62,12 @@ Feature: User-defined metadata
71
62
  """ruby
72
63
  describe "a group with user-defined metadata", :foo => 'bar' do
73
64
  it 'can be overridden by an example', :foo => 'bazz' do |example|
74
- example.metadata[:foo].should == 'bazz'
65
+ expect(example.metadata[:foo]).to eq('bazz')
75
66
  end
76
67
 
77
68
  describe "a sub-group with an override", :foo => 'goo' do
78
69
  it 'can be overridden by a sub-group' do |example|
79
- example.metadata[:foo].should == 'goo'
70
+ expect(example.metadata[:foo]).to eq('goo')
80
71
  end
81
72
  end
82
73
  end
@@ -87,25 +78,21 @@ Feature: User-defined metadata
87
78
  Scenario: less verbose metadata
88
79
  Given a file named "less_verbose_metadata_spec.rb" with:
89
80
  """ruby
90
- RSpec.configure do |c|
91
- c.treat_symbols_as_metadata_keys_with_true_values = true
92
- end
93
-
94
81
  describe "a group with simple metadata", :fast, :simple, :bug => 73 do
95
82
  it 'has `:fast => true` metadata' do |example|
96
- example.metadata[:fast].should == true
83
+ expect(example.metadata[:fast]).to eq(true)
97
84
  end
98
85
 
99
86
  it 'has `:simple => true` metadata' do |example|
100
- example.metadata[:simple].should == true
87
+ expect(example.metadata[:simple]).to eq(true)
101
88
  end
102
89
 
103
90
  it 'can still use a hash for metadata' do |example|
104
- example.metadata[:bug].should eq(73)
91
+ expect(example.metadata[:bug]).to eq(73)
105
92
  end
106
93
 
107
94
  it 'can define simple metadata on an example', :special do |example|
108
- example.metadata[:special].should == true
95
+ expect(example.metadata[:special]).to eq(true)
109
96
  end
110
97
  end
111
98
  """