rspec-core 2.99.2 → 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -115,29 +115,6 @@ module RSpec
115
115
  it_has_behavior "matching by line number"
116
116
  end
117
117
 
118
- context "with a :line_numbers filter" do
119
- before(:each) { Metadata.line_number_filter_deprecation_issued = false }
120
- after(:all) { Metadata.line_number_filter_deprecation_issued = false }
121
- let(:metadata) { Metadata.new.process("group") }
122
-
123
- context "when a line number filter is applied manually (e.g. not from the command line)" do
124
- it 'issues a deprecation warning' do
125
- expect_deprecation_with_call_site(__FILE__, __LINE__ + 1, /:line_numbers/)
126
- metadata.filter_applies?(:line_numbers, [2])
127
- end
128
- end
129
-
130
- context "when a line number filter is applied from the command line" do
131
- it "does not issue an additional deprecation" do
132
- allow_deprecation
133
- Parser.parse!(["--line-number", "3"])
134
-
135
- expect_no_deprecation
136
- metadata.filter_applies?(:line_numbers, [2])
137
- end
138
- end
139
- end
140
-
141
118
  context "with locations" do
142
119
  let(:condition_key){ :locations }
143
120
  let(:parent_group_condition) do
@@ -284,7 +261,7 @@ module RSpec
284
261
  end
285
262
 
286
263
  [:described_class, :describes].each do |key|
287
- describe key.inspect do
264
+ describe key do
288
265
  context "with a String" do
289
266
  it "returns nil" do
290
267
  m = Metadata.new
@@ -5,6 +5,7 @@ module RSpec::Core
5
5
  let(:output_file){ mock File }
6
6
 
7
7
  before do
8
+ RSpec.stub(:deprecate)
8
9
  File.stub(:open).with("foo.txt",'w') { (output_file) }
9
10
  end
10
11
 
@@ -27,7 +28,7 @@ module RSpec::Core
27
28
 
28
29
  describe "--formatter" do
29
30
  it "is deprecated" do
30
- expect_deprecation_with_no_call_site(%r{`--formatter`})
31
+ RSpec.should_receive(:deprecate)
31
32
  Parser.parse!(%w[--formatter doc])
32
33
  end
33
34
 
@@ -38,11 +39,6 @@ module RSpec::Core
38
39
  end
39
40
 
40
41
  describe "--default_path" do
41
- it "is deprecated" do
42
- expect_deprecation_with_no_call_site(%r{`--default_path`})
43
- Parser.parse!(%w[--default_path foo])
44
- end
45
-
46
42
  it "gets converted to --default-path" do
47
43
  options = Parser.parse!(%w[--default_path foo])
48
44
  expect(options[:default_path]).to eq "foo"
@@ -50,17 +46,13 @@ module RSpec::Core
50
46
  end
51
47
 
52
48
  describe "--line_number" do
53
- it "is deprecated" do
54
- expect_deprecation_with_no_call_site(%r{`--line-number`/`-l`})
55
- Parser.parse!(%w[--line_number 3])
56
- end
57
-
58
49
  it "gets converted to --line-number" do
59
50
  options = Parser.parse!(%w[--line_number 3])
60
51
  expect(options[:line_numbers]).to eq ["3"]
61
52
  end
62
53
  end
63
54
 
55
+
64
56
  describe "--default-path" do
65
57
  it "sets the default path where RSpec looks for examples" do
66
58
  options = Parser.parse!(%w[--default-path foo])
@@ -74,11 +66,6 @@ module RSpec::Core
74
66
  options = Parser.parse!([option, "3"])
75
67
  expect(options[:line_numbers]).to eq ["3"]
76
68
  end
77
-
78
- it "is deprecated" do
79
- expect_deprecation_with_no_call_site(%r{`--line-number`/`-l`})
80
- Parser.parse!([option, "3"])
81
- end
82
69
  end
83
70
  end
84
71
 
@@ -91,29 +78,6 @@ module RSpec::Core
91
78
  end
92
79
  end
93
80
 
94
- describe "--deprecation-out" do
95
- it 'configures the deprecation stream' do
96
- expect {
97
- Parser.parse!(['--deprecation-out', 'path/to/file.log'])
98
- }.to change { RSpec.configuration.deprecation_stream }.to('path/to/file.log')
99
- end
100
-
101
- it 'sets the deprecation stream before processing other options that issue deprecations' do
102
- expect(RSpec).to receive(:deprecate) do
103
- expect(RSpec.configuration.deprecation_stream).to eq('path/to/file.log')
104
- end
105
-
106
- Parser.parse!(['--line-number', '3', '--deprecation-out', 'path/to/file.log'])
107
- end
108
-
109
- it 'issues an appropriate error when no file arg is provided' do
110
- out_error = Parser.parse!(['--out']) rescue $!
111
- expect {
112
- Parser.parse!(['--deprecation-out'])
113
- }.to raise_error(out_error.class, out_error.message.gsub('--out', '--deprecation-out'))
114
- end
115
- end
116
-
117
81
  %w[--out -o].each do |option|
118
82
  describe option do
119
83
  let(:options) { Parser.parse!([option, 'out.txt']) }
@@ -193,6 +157,21 @@ module RSpec::Core
193
157
  options = Parser.parse!([option, 'foo:any_string'])
194
158
  expect(options[:inclusion_filter]).to eq(:foo => 'any_string')
195
159
  end
160
+
161
+ it "treats ':any_sym' as :any_sym" do
162
+ options = Parser.parse!([option, 'foo::any_sym'])
163
+ expect(options[:inclusion_filter]).to eq(:foo => :any_sym)
164
+ end
165
+
166
+ it "treats '42' as 42" do
167
+ options = Parser.parse!([option, 'foo:42'])
168
+ expect(options[:inclusion_filter]).to eq(:foo => 42)
169
+ end
170
+
171
+ it "treats '3.146' as 3.146" do
172
+ options = Parser.parse!([option, 'foo:3.146'])
173
+ expect(options[:inclusion_filter]).to eq(:foo => 3.146)
174
+ end
196
175
  end
197
176
 
198
177
  context "with ~" do
@@ -232,25 +211,6 @@ module RSpec::Core
232
211
  end
233
212
  end
234
213
  end
235
-
236
- context "with default" do
237
- it 'defines the order as defined' do
238
- options = Parser.parse!(['--order', 'default'])
239
- expect(options[:order]).to eq('defined')
240
- end
241
-
242
- it 'prints a deprecation warning' do
243
- expect_deprecation_with_no_call_site(/default/)
244
- Parser.parse!(['--order', 'default'])
245
- end
246
- end
247
-
248
- context "with defined" do
249
- it 'defines the order as defined' do
250
- options = Parser.parse!(['--order', 'defined'])
251
- expect(options[:order]).to eq('defined')
252
- end
253
- end
254
214
  end
255
215
 
256
216
  describe "--seed" do
@@ -272,15 +232,13 @@ module RSpec::Core
272
232
  end
273
233
 
274
234
  it 'sets profile_examples to true when accidentally combined with path' do
275
- allow(Kernel).to receive(:warn)
235
+ allow_warning
276
236
  options = Parser.parse!(%w[--profile some/path])
277
237
  expect(options[:profile_examples]).to eq true
278
238
  end
279
239
 
280
240
  it 'warns when accidentally combined with path' do
281
- expect(Kernel).to receive(:warn) do |msg|
282
- expect(msg).to match "Non integer specified as profile count"
283
- end
241
+ expect_warning_without_call_site "Non integer specified as profile count"
284
242
  options = Parser.parse!(%w[--profile some/path])
285
243
  expect(options[:profile_examples]).to eq true
286
244
  end
@@ -0,0 +1,102 @@
1
+ require "spec_helper"
2
+
3
+ module RSpec
4
+ module Core
5
+ module Ordering
6
+ describe Identity do
7
+ it "does not affect the ordering of the items" do
8
+ expect(Identity.new.order([1, 2, 3])).to eq([1, 2, 3])
9
+ end
10
+ end
11
+
12
+ describe Random do
13
+ describe '.order' do
14
+ subject { described_class.new(configuration) }
15
+
16
+ let(:configuration) { RSpec::Core::Configuration.new }
17
+ let(:items) { 10.times.map { |n| n } }
18
+ let(:shuffled_items) { subject.order items }
19
+
20
+ it 'shuffles the items randomly' do
21
+ expect(shuffled_items).to match_array items
22
+ expect(shuffled_items).to_not eq items
23
+ end
24
+
25
+ context 'given multiple calls' do
26
+ it 'returns the items in the same order' do
27
+ expect(subject.order(items)).to eq shuffled_items
28
+ end
29
+ end
30
+
31
+ context 'given randomization has been seeded explicitly' do
32
+ before { @seed = srand }
33
+ after { srand @seed }
34
+
35
+ it "does not affect the global random number generator" do
36
+ srand 123
37
+ val1, val2 = rand(1_000), rand(1_000)
38
+
39
+ subject
40
+
41
+ srand 123
42
+ subject.order items
43
+ expect(rand(1_000)).to eq(val1)
44
+ subject.order items
45
+ expect(rand(1_000)).to eq(val2)
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ describe Custom do
52
+ it 'uses the block to order the list' do
53
+ strategy = Custom.new(proc { |list| list.reverse })
54
+
55
+ expect(strategy.order([1, 2, 3, 4])).to eq([4, 3, 2, 1])
56
+ end
57
+ end
58
+
59
+ describe Registry do
60
+ let(:configuration) { Configuration.new }
61
+ subject(:registry) { Registry.new(configuration) }
62
+
63
+ describe "#used_random_seed?" do
64
+ it 'returns false if the random orderer has not been used' do
65
+ expect(registry.used_random_seed?).to be false
66
+ end
67
+
68
+ it 'returns false if the random orderer has been fetched but not used' do
69
+ expect(registry.fetch(:random)).to be_a(Random)
70
+ expect(registry.used_random_seed?).to be false
71
+ end
72
+
73
+ it 'returns true if the random orderer has been used' do
74
+ registry.fetch(:random).order([1, 2])
75
+ expect(registry.used_random_seed?).to be true
76
+ end
77
+ end
78
+
79
+ describe "#fetch" do
80
+ it "gives the registered ordering when called with a symbol" do
81
+ ordering = Object.new
82
+ subject.register(:falcon, ordering)
83
+
84
+ expect(subject.fetch(:falcon)).to be ordering
85
+ end
86
+
87
+ context "when given an unrecognized symbol" do
88
+ it 'invokes the given block and returns its value' do
89
+ expect(subject.fetch(:falcon) { :fallback }).to eq(:fallback)
90
+ end
91
+
92
+ it 'raises an error if no block is given' do
93
+ expect {
94
+ subject.fetch(:falcon)
95
+ }.to raise_error(IndexError)
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
@@ -55,19 +55,6 @@ describe "an example" do
55
55
  example.run(group.new, double.as_null_object)
56
56
  expect(example).to be_pending_with(RSpec::Core::Pending::NO_REASON_GIVEN)
57
57
  end
58
-
59
- it 'shows upgrade warning' do
60
- expect_warn_deprecation_with_call_site(
61
- "pending_example_spec.rb", __LINE__ + 4
62
- )
63
- group = RSpec::Core::ExampleGroup.describe('group') do
64
- it "does something" do
65
- pending
66
- end
67
- end
68
- example = group.examples.first
69
- example.run(group.new, double.as_null_object)
70
- end
71
58
  end
72
59
 
73
60
  context "with no docstring" do
@@ -117,20 +104,6 @@ describe "an example" do
117
104
  end
118
105
  end
119
106
 
120
- context "skip with a block" do
121
- it "does not execute the block" do
122
- called = false
123
- group = RSpec::Core::ExampleGroup.describe('group') do
124
- it "does something" do
125
- skip { called = true }
126
- end
127
- end
128
- example = group.examples.first
129
- example.run(group.new, double.as_null_object)
130
- expect(called).to eq(false)
131
- end
132
- end
133
-
134
107
  context "with a block" do
135
108
  def run_example(*pending_args, &block)
136
109
  group = RSpec::Core::ExampleGroup.describe('group') do
@@ -143,19 +116,6 @@ describe "an example" do
143
116
  example
144
117
  end
145
118
 
146
- it 'shows upgrade warning' do
147
- expect_warn_deprecation_with_call_site(
148
- "pending_example_spec.rb", __LINE__ + 4
149
- )
150
- group = RSpec::Core::ExampleGroup.describe('group') do
151
- it "does something" do
152
- pending {}
153
- end
154
- end
155
- example = group.examples.first
156
- example.run(group.new, double.as_null_object)
157
- end
158
-
159
119
  context "that fails" do
160
120
  def run_example(*pending_args)
161
121
  super(*pending_args) { raise ArgumentError.new }
@@ -1,4 +1,5 @@
1
1
  require "spec_helper"
2
+ require 'rspec/core/project_initializer'
2
3
 
3
4
  module RSpec::Core
4
5
  describe ProjectInitializer, :isolated_directory => true do
@@ -8,7 +9,6 @@ module RSpec::Core
8
9
  let(:command_line_config) { ProjectInitializer.new }
9
10
 
10
11
  before do
11
- command_line_config.stub(:warn)
12
12
  command_line_config.stub(:puts)
13
13
  command_line_config.stub(:gets => 'no')
14
14
  end
@@ -68,30 +68,6 @@ module RSpec::Core
68
68
  end
69
69
  end
70
70
 
71
- context "with autotest/discover.rb" do
72
- before do
73
- FileUtils.mkdir('autotest')
74
- FileUtils.touch 'autotest/discover.rb'
75
- end
76
-
77
- it "asks whether to delete the file" do
78
- command_line_config.should_receive(:puts).with(/delete/)
79
- command_line_config.run
80
- end
81
-
82
- it "removes it if confirmed" do
83
- command_line_config.stub(:gets => 'yes')
84
- command_line_config.run
85
- expect(File.exist?('autotest/discover.rb')).to be_falsey
86
- end
87
-
88
- it "leaves it if not confirmed" do
89
- command_line_config.stub(:gets => 'no')
90
- command_line_config.run
91
- expect(File.exist?('autotest/discover.rb')).to be_truthy
92
- end
93
- end
94
-
95
71
  context "with lib/tasks/rspec.rake" do
96
72
  before do
97
73
  FileUtils.mkdir_p('lib/tasks')
@@ -10,11 +10,6 @@ module RSpec::Core
10
10
  FileUtils::RUBY
11
11
  end
12
12
 
13
- def with_rcov
14
- task.rcov = true
15
- yield
16
- end
17
-
18
13
  def spec_command
19
14
  task.__send__(:spec_command)
20
15
  end
@@ -44,79 +39,17 @@ module RSpec::Core
44
39
  end
45
40
  end
46
41
 
47
- context "with rcov" do
48
- before { allow(RSpec).to receive(:deprecate) }
49
-
50
- it "renders rcov" do
51
- with_rcov do
52
- expect(spec_command).to match(/^#{ruby} -S rcov/)
53
- end
54
- end
55
-
56
- it 'warns of deprecation' do
57
- expect(RSpec).to receive(:deprecate)
58
- with_rcov { spec_command }
59
- end
60
- end
61
-
62
42
  context "with ruby options" do
63
43
  it "renders them before -S" do
64
- task.ruby_opts = "-w"
65
- expect(spec_command).to match(/^#{ruby} -w -S rspec/)
66
- end
67
- end
68
-
69
- context "with rcov_opts" do
70
- before { allow(RSpec).to receive(:deprecate) }
71
-
72
- context "with rcov=false (default)" do
73
- it "does not add the rcov options to the command" do
74
- task.rcov_opts = '--exclude "mocks"'
75
- expect(spec_command).not_to match(/--exclude "mocks"/)
76
- end
77
-
78
- it 'warns of deprecation' do
79
- expect(RSpec).to receive(:deprecate)
80
- task.rcov_opts = '--exclude "mocks"'
81
- end
82
- end
83
-
84
- context "with rcov=true" do
85
- it "renders them after rcov" do
86
- task.rcov = true
87
- task.rcov_opts = '--exclude "mocks"'
88
- expect(spec_command).to match(/rcov.*--exclude "mocks"/)
89
- end
90
-
91
- it "ensures that -Ispec:lib is in the resulting command" do
92
- task.rcov = true
93
- task.rcov_opts = '--exclude "mocks"'
94
- expect(spec_command).to match(/rcov.*-Ispec:lib/)
95
- end
96
-
97
- it 'warns of deprecation' do
98
- expect(RSpec).to receive(:deprecate)
99
- task.rcov_opts = '--exclude "mocks"'
100
- end
44
+ task.ruby_opts = "-w"
45
+ expect(spec_command).to match(/^#{ruby} -w -S rspec/)
101
46
  end
102
47
  end
103
48
 
104
49
  context "with rspec_opts" do
105
- before { allow(RSpec).to receive(:deprecate) }
106
-
107
- context "with rcov=true" do
108
- it "adds the rspec_opts after the rcov_opts and files" do
109
- task.stub(:files_to_run) { "this.rb that.rb" }
110
- task.rcov = true
111
- task.rspec_opts = "-Ifoo"
112
- expect(spec_command).to match(/this.rb that.rb -- -Ifoo/)
113
- end
114
- end
115
- context "with rcov=false (default)" do
116
- it "adds the rspec_opts" do
117
- task.rspec_opts = "-Ifoo"
118
- expect(spec_command).to match(/rspec.*-Ifoo/)
119
- end
50
+ it "adds the rspec_opts" do
51
+ task.rspec_opts = "-Ifoo"
52
+ expect(spec_command).to match(/rspec.*-Ifoo/)
120
53
  end
121
54
  end
122
55