rspec-core 3.0.0.beta2 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.yardopts +1 -0
  5. data/Changelog.md +297 -57
  6. data/README.md +16 -13
  7. data/lib/rspec/core.rb +55 -84
  8. data/lib/rspec/core/backport_random.rb +35 -3
  9. data/lib/rspec/core/backtrace_formatter.rb +4 -13
  10. data/lib/rspec/core/configuration.rb +330 -114
  11. data/lib/rspec/core/configuration_options.rb +38 -22
  12. data/lib/rspec/core/drb.rb +111 -0
  13. data/lib/rspec/core/dsl.rb +8 -2
  14. data/lib/rspec/core/example.rb +203 -94
  15. data/lib/rspec/core/example_group.rb +344 -316
  16. data/lib/rspec/core/filter_manager.rb +135 -90
  17. data/lib/rspec/core/flat_map.rb +1 -0
  18. data/lib/rspec/core/formatters.rb +50 -14
  19. data/lib/rspec/core/formatters/base_formatter.rb +32 -138
  20. data/lib/rspec/core/formatters/base_text_formatter.rb +32 -253
  21. data/lib/rspec/core/formatters/console_codes.rb +65 -0
  22. data/lib/rspec/core/formatters/deprecation_formatter.rb +24 -15
  23. data/lib/rspec/core/formatters/documentation_formatter.rb +7 -10
  24. data/lib/rspec/core/formatters/helpers.rb +15 -9
  25. data/lib/rspec/core/formatters/html_formatter.rb +17 -16
  26. data/lib/rspec/core/formatters/html_printer.rb +1 -0
  27. data/lib/rspec/core/formatters/json_formatter.rb +18 -20
  28. data/lib/rspec/core/formatters/profile_formatter.rb +67 -0
  29. data/lib/rspec/core/formatters/progress_formatter.rb +6 -7
  30. data/lib/rspec/core/formatters/snippet_extractor.rb +8 -6
  31. data/lib/rspec/core/hooks.rb +131 -125
  32. data/lib/rspec/core/memoized_helpers.rb +31 -26
  33. data/lib/rspec/core/metadata.rb +277 -184
  34. data/lib/rspec/core/metadata_filter.rb +86 -0
  35. data/lib/rspec/core/minitest_assertions_adapter.rb +28 -0
  36. data/lib/rspec/core/mocking_adapters/flexmock.rb +1 -1
  37. data/lib/rspec/core/mocking_adapters/mocha.rb +1 -1
  38. data/lib/rspec/core/mocking_adapters/null.rb +1 -1
  39. data/lib/rspec/core/mocking_adapters/rr.rb +2 -1
  40. data/lib/rspec/core/mocking_adapters/rspec.rb +1 -1
  41. data/lib/rspec/core/notifications.rb +435 -24
  42. data/lib/rspec/core/option_parser.rb +16 -25
  43. data/lib/rspec/core/ordering.rb +3 -1
  44. data/lib/rspec/core/pending.rb +57 -33
  45. data/lib/rspec/core/project_initializer.rb +2 -0
  46. data/lib/rspec/core/project_initializer/spec_helper.rb +5 -4
  47. data/lib/rspec/core/rake_task.rb +45 -20
  48. data/lib/rspec/core/reporter.rb +50 -22
  49. data/lib/rspec/core/ruby_project.rb +1 -0
  50. data/lib/rspec/core/runner.rb +93 -39
  51. data/lib/rspec/core/shared_context.rb +7 -5
  52. data/lib/rspec/core/shared_example_group.rb +85 -77
  53. data/lib/rspec/core/test_unit_assertions_adapter.rb +30 -0
  54. data/lib/rspec/core/version.rb +3 -1
  55. data/lib/rspec/core/warnings.rb +35 -17
  56. data/lib/rspec/core/world.rb +57 -5
  57. metadata +56 -369
  58. metadata.gz.sig +3 -3
  59. data/features/README.md +0 -13
  60. data/features/Upgrade.md +0 -352
  61. data/features/command_line/README.md +0 -25
  62. data/features/command_line/dry_run.feature +0 -29
  63. data/features/command_line/example_name_option.feature +0 -97
  64. data/features/command_line/exit_status.feature +0 -82
  65. data/features/command_line/fail_fast.feature +0 -26
  66. data/features/command_line/format_option.feature +0 -75
  67. data/features/command_line/init.feature +0 -57
  68. data/features/command_line/line_number_appended_to_path.feature +0 -140
  69. data/features/command_line/line_number_option.feature +0 -58
  70. data/features/command_line/order.feature +0 -25
  71. data/features/command_line/pattern_option.feature +0 -49
  72. data/features/command_line/rake_task.feature +0 -122
  73. data/features/command_line/randomization.feature +0 -63
  74. data/features/command_line/require_option.feature +0 -43
  75. data/features/command_line/ruby.feature +0 -23
  76. data/features/command_line/tag.feature +0 -98
  77. data/features/command_line/warnings_option.feature +0 -29
  78. data/features/configuration/alias_example_to.feature +0 -39
  79. data/features/configuration/backtrace_exclusion_patterns.feature +0 -105
  80. data/features/configuration/custom_settings.feature +0 -84
  81. data/features/configuration/default_path.feature +0 -38
  82. data/features/configuration/deprecation_stream.feature +0 -58
  83. data/features/configuration/enable_global_dsl.feature +0 -54
  84. data/features/configuration/fail_fast.feature +0 -77
  85. data/features/configuration/failure_exit_code.feature +0 -36
  86. data/features/configuration/order_and_seed.feature +0 -3
  87. data/features/configuration/output_stream.feature +0 -24
  88. data/features/configuration/overriding_global_ordering.feature +0 -93
  89. data/features/configuration/pattern.feature +0 -38
  90. data/features/configuration/profile.feature +0 -220
  91. data/features/configuration/read_options_from_file.feature +0 -90
  92. data/features/configuration/run_all_when_everything_filtered.feature +0 -76
  93. data/features/example_groups/aliasing.feature +0 -48
  94. data/features/example_groups/basic_structure.feature +0 -55
  95. data/features/example_groups/shared_context.feature +0 -74
  96. data/features/example_groups/shared_examples.feature +0 -286
  97. data/features/expectation_framework_integration/configure_expectation_framework.feature +0 -102
  98. data/features/filtering/exclusion_filters.feature +0 -135
  99. data/features/filtering/if_and_unless.feature +0 -138
  100. data/features/filtering/inclusion_filters.feature +0 -101
  101. data/features/formatters/configurable_colors.feature +0 -31
  102. data/features/formatters/custom_formatter.feature +0 -68
  103. data/features/formatters/json_formatter.feature +0 -30
  104. data/features/formatters/regression_tests.feature +0 -95
  105. data/features/formatters/text_formatter.feature +0 -46
  106. data/features/helper_methods/arbitrary_methods.feature +0 -40
  107. data/features/helper_methods/let.feature +0 -50
  108. data/features/helper_methods/modules.feature +0 -146
  109. data/features/hooks/around_hooks.feature +0 -344
  110. data/features/hooks/before_and_after_hooks.feature +0 -427
  111. data/features/hooks/filtering.feature +0 -232
  112. data/features/metadata/current_example.feature +0 -56
  113. data/features/metadata/described_class.feature +0 -17
  114. data/features/metadata/user_defined.feature +0 -100
  115. data/features/mock_framework_integration/use_any_framework.feature +0 -106
  116. data/features/mock_framework_integration/use_flexmock.feature +0 -94
  117. data/features/mock_framework_integration/use_mocha.feature +0 -95
  118. data/features/mock_framework_integration/use_rr.feature +0 -96
  119. data/features/mock_framework_integration/use_rspec.feature +0 -95
  120. data/features/pending_and_skipped_examples/README.md +0 -3
  121. data/features/pending_and_skipped_examples/pending_examples.feature +0 -118
  122. data/features/pending_and_skipped_examples/skipped_examples.feature +0 -106
  123. data/features/spec_files/arbitrary_file_suffix.feature +0 -13
  124. data/features/step_definitions/additional_cli_steps.rb +0 -83
  125. data/features/subject/explicit_subject.feature +0 -101
  126. data/features/subject/implicit_subject.feature +0 -63
  127. data/features/subject/one_liner_syntax.feature +0 -71
  128. data/features/support/env.rb +0 -21
  129. data/features/support/require_expect_syntax_in_aruba_specs.rb +0 -16
  130. data/features/support/rubinius.rb +0 -6
  131. data/lib/rspec/core/command_line.rb +0 -35
  132. data/lib/rspec/core/drb_command_line.rb +0 -26
  133. data/lib/rspec/core/drb_options.rb +0 -87
  134. data/lib/rspec/core/formatters/legacy_formatter.rb +0 -227
  135. data/lib/rspec/core/shared_example_group/collection.rb +0 -27
  136. data/spec/command_line/order_spec.rb +0 -211
  137. data/spec/rspec/core/backtrace_formatter_spec.rb +0 -230
  138. data/spec/rspec/core/command_line_spec.rb +0 -112
  139. data/spec/rspec/core/command_line_spec_output.txt +0 -0
  140. data/spec/rspec/core/configuration_options_spec.rb +0 -409
  141. data/spec/rspec/core/configuration_spec.rb +0 -1479
  142. data/spec/rspec/core/drb_command_line_spec.rb +0 -102
  143. data/spec/rspec/core/drb_options_spec.rb +0 -193
  144. data/spec/rspec/core/dsl_spec.rb +0 -88
  145. data/spec/rspec/core/example_group_spec.rb +0 -1533
  146. data/spec/rspec/core/example_spec.rb +0 -642
  147. data/spec/rspec/core/filter_manager_spec.rb +0 -229
  148. data/spec/rspec/core/formatters/base_formatter_spec.rb +0 -64
  149. data/spec/rspec/core/formatters/base_text_formatter_spec.rb +0 -303
  150. data/spec/rspec/core/formatters/deprecation_formatter_spec.rb +0 -208
  151. data/spec/rspec/core/formatters/documentation_formatter_spec.rb +0 -75
  152. data/spec/rspec/core/formatters/helpers_spec.rb +0 -104
  153. data/spec/rspec/core/formatters/html_formatted-2.1.0.html +0 -392
  154. data/spec/rspec/core/formatters/html_formatted.html +0 -397
  155. data/spec/rspec/core/formatters/html_formatter_spec.rb +0 -122
  156. data/spec/rspec/core/formatters/json_formatter_spec.rb +0 -206
  157. data/spec/rspec/core/formatters/legacy_formatter_spec.rb +0 -137
  158. data/spec/rspec/core/formatters/progress_formatter_spec.rb +0 -43
  159. data/spec/rspec/core/formatters/snippet_extractor_spec.rb +0 -26
  160. data/spec/rspec/core/formatters_spec.rb +0 -120
  161. data/spec/rspec/core/hooks_filtering_spec.rb +0 -227
  162. data/spec/rspec/core/hooks_spec.rb +0 -294
  163. data/spec/rspec/core/memoized_helpers_spec.rb +0 -495
  164. data/spec/rspec/core/metadata_spec.rb +0 -491
  165. data/spec/rspec/core/option_parser_spec.rb +0 -262
  166. data/spec/rspec/core/ordering_spec.rb +0 -102
  167. data/spec/rspec/core/pending_example_spec.rb +0 -117
  168. data/spec/rspec/core/pending_spec.rb +0 -8
  169. data/spec/rspec/core/project_initializer_spec.rb +0 -73
  170. data/spec/rspec/core/rake_task_spec.rb +0 -146
  171. data/spec/rspec/core/random_spec.rb +0 -47
  172. data/spec/rspec/core/reporter_spec.rb +0 -155
  173. data/spec/rspec/core/resources/a_bar.rb +0 -0
  174. data/spec/rspec/core/resources/a_foo.rb +0 -0
  175. data/spec/rspec/core/resources/a_spec.rb +0 -1
  176. data/spec/rspec/core/resources/custom_example_group_runner.rb +0 -14
  177. data/spec/rspec/core/resources/formatter_specs.rb +0 -58
  178. data/spec/rspec/core/resources/utf8_encoded.rb +0 -8
  179. data/spec/rspec/core/rspec_matchers_spec.rb +0 -45
  180. data/spec/rspec/core/ruby_project_spec.rb +0 -26
  181. data/spec/rspec/core/runner_spec.rb +0 -151
  182. data/spec/rspec/core/shared_context_spec.rb +0 -102
  183. data/spec/rspec/core/shared_example_group/collection_spec.rb +0 -57
  184. data/spec/rspec/core/shared_example_group_spec.rb +0 -114
  185. data/spec/rspec/core/warnings_spec.rb +0 -29
  186. data/spec/rspec/core/world_spec.rb +0 -142
  187. data/spec/rspec/core_spec.rb +0 -91
  188. data/spec/spec_helper.rb +0 -160
  189. data/spec/support/config_options_helper.rb +0 -13
  190. data/spec/support/formatter_support.rb +0 -83
  191. data/spec/support/helper_methods.rb +0 -26
  192. data/spec/support/isolate_load_path_mutation.rb +0 -5
  193. data/spec/support/isolated_directory.rb +0 -10
  194. data/spec/support/isolated_home_directory.rb +0 -16
  195. data/spec/support/legacy_formatter_using_sub_classing_example.rb +0 -87
  196. data/spec/support/matchers.rb +0 -85
  197. data/spec/support/mathn_integration_support.rb +0 -12
  198. data/spec/support/old_style_formatter_example.rb +0 -69
  199. data/spec/support/shared_example_groups.rb +0 -13
  200. data/spec/support/spec_files.rb +0 -44
  201. data/spec/support/stderr_splitter.rb +0 -36
@@ -1,102 +0,0 @@
1
- Feature: configure expectation framework
2
-
3
- By default, RSpec is configured to include rspec-expectations for expressing
4
- desired outcomes. You can also configure RSpec to use:
5
-
6
- * rspec/expectations (explicitly)
7
- * stdlib assertions
8
- * test/unit assertions in ruby 1.8
9
- * minitest assertions in ruby 1.9
10
- * rspec/expectations _and_ stlib assertions
11
-
12
- Note that when you do not use rspec-expectations, you must explicitly
13
- provide a description to every example. You cannot rely on the generated
14
- descriptions provided by rspec-expectations.
15
-
16
- Scenario: rspec-expectations can be used by default if nothing is configured
17
- Given a file named "example_spec.rb" with:
18
- """ruby
19
- RSpec::Matchers.define :be_a_multiple_of do |factor|
20
- match do |actual|
21
- actual % factor == 0
22
- end
23
- end
24
-
25
- describe 6 do
26
- it { is_expected.to be_a_multiple_of 3 }
27
- end
28
- """
29
- When I run `rspec example_spec.rb`
30
- Then the examples should all pass
31
-
32
- Scenario: configure rspec-expectations (explicitly)
33
- Given a file named "example_spec.rb" with:
34
- """ruby
35
- RSpec.configure do |config|
36
- config.expect_with :rspec
37
- end
38
-
39
- describe 5 do
40
- it "is greater than 4" do
41
- expect(5).to be > 4
42
- end
43
- end
44
- """
45
- When I run `rspec example_spec.rb`
46
- Then the examples should all pass
47
-
48
- Scenario: configure test/unit assertions (passing examples)
49
- Given a file named "example_spec.rb" with:
50
- """ruby
51
- RSpec.configure do |config|
52
- config.expect_with :stdlib
53
- end
54
-
55
- describe 5 do
56
- it "is greater than 4" do
57
- assert 5 > 4, "expected 5 to be greater than 4"
58
- end
59
-
60
- specify { assert 5 < 6 }
61
- end
62
- """
63
- When I run `rspec example_spec.rb`
64
- Then the output should contain "2 examples, 0 failures"
65
-
66
- Scenario: configure test/unit assertions (failing examples)
67
- Given a file named "example_spec.rb" with:
68
- """ruby
69
- RSpec.configure do |config|
70
- config.expect_with :stdlib
71
- end
72
-
73
- describe 5 do
74
- it "is greater than 6 (no it isn't!)" do
75
- assert 5 > 6, "errantly expected 5 to be greater than 5"
76
- end
77
-
78
- specify { assert 5 > 6 }
79
- end
80
- """
81
- When I run `rspec example_spec.rb`
82
- Then the output should contain "2 examples, 2 failures"
83
-
84
- Scenario: configure rspec/expecations AND test/unit assertions
85
- Given a file named "example_spec.rb" with:
86
- """ruby
87
- RSpec.configure do |config|
88
- config.expect_with :rspec, :stdlib
89
- end
90
-
91
- describe 5 do
92
- it "is greater than 4" do
93
- assert 5 > 4, "expected 5 to be greater than 4"
94
- end
95
-
96
- it "is less than 6" do
97
- expect(5).to be < 6
98
- end
99
- end
100
- """
101
- When I run `rspec example_spec.rb`
102
- Then the examples should all pass
@@ -1,135 +0,0 @@
1
- Feature: exclusion filters
2
-
3
- You can exclude examples from a run by declaring an exclusion filter and
4
- then tagging examples, or entire groups, with that filter. You can also
5
- specify metadata using only symbols.
6
-
7
- Scenario: exclude an example
8
- Given a file named "spec/sample_spec.rb" with:
9
- """ruby
10
- RSpec.configure do |c|
11
- # declare an exclusion filter
12
- c.filter_run_excluding :broken => true
13
- end
14
-
15
- describe "something" do
16
- it "does one thing" do
17
- end
18
-
19
- # tag example for exclusion by adding metadata
20
- it "does another thing", :broken => true do
21
- end
22
- end
23
- """
24
- When I run `rspec ./spec/sample_spec.rb --format doc`
25
- Then the output should contain "does one thing"
26
- And the output should not contain "does another thing"
27
-
28
- Scenario: exclude a group
29
- Given a file named "spec/sample_spec.rb" with:
30
- """ruby
31
- RSpec.configure do |c|
32
- c.filter_run_excluding :broken => true
33
- end
34
-
35
- describe "group 1", :broken => true do
36
- it "group 1 example 1" do
37
- end
38
-
39
- it "group 1 example 2" do
40
- end
41
- end
42
-
43
- describe "group 2" do
44
- it "group 2 example 1" do
45
- end
46
- end
47
- """
48
- When I run `rspec ./spec/sample_spec.rb --format doc`
49
- Then the output should contain "group 2 example 1"
50
- And the output should not contain "group 1 example 1"
51
- And the output should not contain "group 1 example 2"
52
-
53
- Scenario: exclude multiple groups
54
- Given a file named "spec/sample_spec.rb" with:
55
- """ruby
56
- RSpec.configure do |c|
57
- c.filter_run_excluding :broken => true
58
- end
59
-
60
- describe "group 1", :broken => true do
61
- before(:all) do
62
- raise "you should not see me"
63
- end
64
-
65
- it "group 1 example 1" do
66
- end
67
-
68
- it "group 1 example 2" do
69
- end
70
- end
71
-
72
- describe "group 2", :broken => true do
73
- before(:each) do
74
- raise "you should not see me"
75
- end
76
-
77
- it "group 2 example 1" do
78
- end
79
- end
80
- """
81
- When I run `rspec ./spec/sample_spec.rb --format doc`
82
- Then the process should succeed even though no examples were run
83
- And the output should not contain "group 1"
84
- And the output should not contain "group 2"
85
-
86
- Scenario: before/after(:all) hooks in excluded example group are not run
87
- Given a file named "spec/before_after_all_exclusion_filter_spec.rb" with:
88
- """ruby
89
- RSpec.configure do |c|
90
- c.filter_run_excluding :broken => true
91
- end
92
-
93
- describe "group 1" do
94
- before(:all) { puts "before all in included group" }
95
- after(:all) { puts "after all in included group" }
96
-
97
- it "group 1 example" do
98
- end
99
- end
100
-
101
- describe "group 2", :broken => true do
102
- before(:all) { puts "before all in excluded group" }
103
- after(:all) { puts "after all in excluded group" }
104
-
105
- context "context 1" do
106
- it "group 2 context 1 example 1" do
107
- end
108
- end
109
- end
110
- """
111
- When I run `rspec ./spec/before_after_all_exclusion_filter_spec.rb`
112
- Then the output should contain "before all in included group"
113
- And the output should contain "after all in included group"
114
- And the output should not contain "before all in excluded group"
115
- And the output should not contain "after all in excluded group"
116
-
117
- Scenario: Use symbols as metadata
118
- Given a file named "symbols_as_metadata_spec.rb" with:
119
- """ruby
120
- RSpec.configure do |c|
121
- c.filter_run_excluding :broken
122
- end
123
-
124
- describe "something" do
125
- it "does one thing" do
126
- end
127
-
128
- # tag example for exclusion by adding metadata
129
- it "does another thing", :broken do
130
- end
131
- end
132
- """
133
- When I run `rspec symbols_as_metadata_spec.rb --format doc`
134
- Then the output should contain "does one thing"
135
- And the output should not contain "does another thing"
@@ -1,138 +0,0 @@
1
- Feature: :if and :unless
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
- """ruby
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
- """ruby
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
- """ruby
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
- """ruby
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 |
@@ -1,101 +0,0 @@
1
- Feature: inclusion filters
2
-
3
- You can constrain which examples are run by declaring an inclusion filter. The
4
- most common use case is to focus on a subset of examples as you're focused on
5
- a particular problem. You can also specify metadata using only symbols.
6
-
7
- Background:
8
- Given a file named "spec/spec_helper.rb" with:
9
- """ruby
10
- RSpec.configure do |c|
11
- c.filter_run_including :focus => true
12
- end
13
- """
14
-
15
- Scenario: focus on an example
16
- Given a file named "spec/sample_spec.rb" with:
17
- """ruby
18
- require "spec_helper"
19
-
20
- describe "something" do
21
- it "does one thing" do
22
- end
23
-
24
- it "does another thing", :focus => true do
25
- end
26
- end
27
- """
28
- When I run `rspec spec/sample_spec.rb --format doc`
29
- Then the output should contain "does another thing"
30
- And the output should not contain "does one thing"
31
-
32
- Scenario: focus on a group
33
- Given a file named "spec/sample_spec.rb" with:
34
- """ruby
35
- require "spec_helper"
36
-
37
- describe "group 1", :focus => true do
38
- it "group 1 example 1" do
39
- end
40
-
41
- it "group 1 example 2" do
42
- end
43
- end
44
-
45
- describe "group 2" do
46
- it "group 2 example 1" do
47
- end
48
- end
49
- """
50
- When I run `rspec spec/sample_spec.rb --format doc`
51
- Then the output should contain "group 1 example 1"
52
- And the output should contain "group 1 example 2"
53
- And the output should not contain "group 2 example 1"
54
-
55
- Scenario: before/after(:all) hooks in unmatched example group are not run
56
- Given a file named "spec/before_after_all_inclusion_filter_spec.rb" with:
57
- """ruby
58
- require "spec_helper"
59
-
60
- describe "group 1", :focus => true do
61
- before(:all) { puts "before all in focused group" }
62
- after(:all) { puts "after all in focused group" }
63
-
64
- it "group 1 example" do
65
- end
66
- end
67
-
68
- describe "group 2" do
69
- before(:all) { puts "before all in unfocused group" }
70
- after(:all) { puts "after all in unfocused group" }
71
-
72
- context "context 1" do
73
- it "group 2 context 1 example 1" do
74
- end
75
- end
76
- end
77
- """
78
- When I run `rspec ./spec/before_after_all_inclusion_filter_spec.rb`
79
- Then the output should contain "before all in focused group"
80
- And the output should contain "after all in focused group"
81
- And the output should not contain "before all in unfocused group"
82
- And the output should not contain "after all in unfocused group"
83
-
84
- Scenario: Use symbols as metadata
85
- Given a file named "symbols_as_metadata_spec.rb" with:
86
- """ruby
87
- RSpec.configure do |c|
88
- c.filter_run :current_example
89
- end
90
-
91
- describe "something" do
92
- it "does one thing" do
93
- end
94
-
95
- it "does another thing", :current_example do
96
- end
97
- end
98
- """
99
- When I run `rspec symbols_as_metadata_spec.rb --format doc`
100
- Then the output should contain "does another thing"
101
- And the output should not contain "does one thing"