rspec-core 2.6.4 → 2.7.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/{bin → exe}/autospec +0 -0
- data/{bin → exe}/rspec +0 -0
- data/features/Upgrade.md +11 -0
- data/features/command_line/exit_status.feature +20 -3
- data/features/command_line/format_option.feature +8 -0
- data/features/command_line/line_number_appended_to_path.feature +35 -1
- data/features/command_line/line_number_option.feature +16 -3
- data/features/command_line/pattern_option.feature +31 -0
- data/features/command_line/rake_task.feature +1 -1
- data/features/command_line/ruby.feature +22 -0
- data/features/configuration/default_path.feature +38 -0
- data/features/example_groups/{shared_example_group.feature → shared_examples.feature} +49 -26
- data/features/expectation_framework_integration/configure_expectation_framework.feature +1 -1
- data/features/filtering/inclusion_filters.feature +4 -5
- data/features/formatters/text_formatter.feature +16 -13
- data/features/helper_methods/let.feature +4 -4
- data/features/hooks/around_hooks.feature +1 -1
- data/features/hooks/before_and_after_hooks.feature +3 -3
- data/features/hooks/filtering.feature +13 -6
- data/features/metadata/user_defined.feature +12 -10
- data/features/pending/pending_examples.feature +21 -8
- data/features/step_definitions/additional_cli_steps.rb +1 -1
- data/features/subject/attribute_of_subject.feature +2 -2
- data/features/support/env.rb +1 -2
- data/lib/rspec/core.rb +1 -23
- data/lib/rspec/core/configuration.rb +64 -16
- data/lib/rspec/core/configuration_options.rb +11 -4
- data/lib/rspec/core/example.rb +10 -7
- data/lib/rspec/core/example_group.rb +34 -18
- data/lib/rspec/core/formatters/base_text_formatter.rb +10 -2
- data/lib/rspec/core/formatters/html_formatter.rb +3 -1
- data/lib/rspec/core/formatters/snippet_extractor.rb +9 -3
- data/lib/rspec/core/formatters/text_mate_formatter.rb +20 -6
- data/lib/rspec/core/hooks.rb +2 -2
- data/lib/rspec/core/let.rb +5 -5
- data/lib/rspec/core/metadata.rb +136 -94
- data/lib/rspec/core/option_parser.rb +10 -5
- data/lib/rspec/core/pending.rb +2 -1
- data/lib/rspec/core/rake_task.rb +26 -15
- data/lib/rspec/core/reporter.rb +2 -3
- data/lib/rspec/core/runner.rb +1 -1
- data/lib/rspec/core/shared_example_group.rb +4 -4
- data/lib/rspec/core/subject.rb +7 -7
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +4 -8
- data/spec/autotest/discover_spec.rb +2 -2
- data/spec/autotest/failed_results_re_spec.rb +29 -21
- data/spec/autotest/rspec_spec.rb +3 -3
- data/spec/rspec/core/command_line_spec.rb +1 -6
- data/spec/rspec/core/configuration_options_spec.rb +65 -13
- data/spec/rspec/core/configuration_spec.rb +148 -37
- data/spec/rspec/core/deprecations_spec.rb +2 -2
- data/spec/rspec/core/drb_command_line_spec.rb +6 -6
- data/spec/rspec/core/example_group_spec.rb +197 -61
- data/spec/rspec/core/example_spec.rb +33 -16
- data/spec/rspec/core/formatters/base_formatter_spec.rb +3 -3
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +149 -1
- data/spec/rspec/core/formatters/helpers_spec.rb +8 -8
- data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +85 -17
- data/spec/rspec/core/formatters/html_formatted-1.8.7.html +12 -11
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +12 -11
- data/spec/rspec/core/formatters/{html_formatted-1.9.1.html → html_formatted-1.9.3.html} +12 -11
- data/spec/rspec/core/formatters/html_formatter_spec.rb +5 -5
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +2 -2
- data/spec/rspec/core/formatters/snippet_extractor_spec.rb +2 -2
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +86 -18
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +13 -12
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +29 -28
- data/spec/rspec/core/formatters/{text_mate_formatted-1.9.1.html → text_mate_formatted-1.9.3.html} +29 -28
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +2 -2
- data/spec/rspec/core/hooks_filtering_spec.rb +18 -18
- data/spec/rspec/core/let_spec.rb +19 -6
- data/spec/rspec/core/metadata_spec.rb +146 -61
- data/spec/rspec/core/pending_example_spec.rb +4 -4
- data/spec/rspec/core/rake_task_spec.rb +71 -50
- data/spec/rspec/core/reporter_spec.rb +2 -2
- data/spec/rspec/core/ruby_project_spec.rb +2 -2
- data/spec/rspec/core/runner_spec.rb +4 -1
- data/spec/rspec/core/shared_example_group_spec.rb +15 -119
- data/spec/rspec/core/subject_spec.rb +13 -13
- data/spec/rspec/core/world_spec.rb +31 -22
- data/spec/rspec/core_spec.rb +1 -29
- data/spec/spec_helper.rb +51 -49
- data/spec/support/shared_example_groups.rb +3 -3
- data/spec/support/spec_files.rb +8 -8
- metadata +79 -93
- data/.document +0 -5
- data/.gitignore +0 -12
- data/.rspec +0 -0
- data/.travis.yml +0 -9
- data/Changelog.md +0 -305
- data/Gemfile +0 -49
- data/Guardfile +0 -5
- data/License.txt +0 -23
- data/Rakefile +0 -93
- data/cucumber.yml +0 -2
- data/features/.nav +0 -57
- data/rspec-core.gemspec +0 -24
- data/script/FullBuildRakeFile +0 -63
- data/script/console +0 -8
- data/script/cucumber +0 -1
- data/script/full_build +0 -1
- data/script/spec +0 -1
- data/spec.txt +0 -1126
- data/spec/rspec/core/formatters/html_formatted-1.8.6.html +0 -398
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.6.html +0 -398
@@ -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
|
19
|
-
count.should
|
18
|
+
count.should eq(1)
|
19
|
+
count.should eq(1)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "is not cached across examples" do
|
23
|
-
count.should
|
23
|
+
count.should eq(2)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
"""
|
@@ -42,7 +42,7 @@ Feature: let and let!
|
|
42
42
|
it "calls the helper method in a before hook" do
|
43
43
|
invocation_order << :example
|
44
44
|
invocation_order.should == [:let!, :example]
|
45
|
-
count.should
|
45
|
+
count.should eq(1)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
"""
|
@@ -187,12 +187,12 @@ Feature: before and after hooks
|
|
187
187
|
describe "stuff in before blocks" do
|
188
188
|
describe "with :all" do
|
189
189
|
it "should be available in the example" do
|
190
|
-
@before_all.should
|
190
|
+
@before_all.should eq("before all")
|
191
191
|
end
|
192
192
|
end
|
193
193
|
describe "with :each" do
|
194
194
|
it "should be available in the example" do
|
195
|
-
@before_each.should
|
195
|
+
@before_each.should eq("before each")
|
196
196
|
end
|
197
197
|
end
|
198
198
|
end
|
@@ -363,7 +363,7 @@ Feature: before and after hooks
|
|
363
363
|
|
364
364
|
describe "nested in parallel" do
|
365
365
|
it "access state set in before(:all)" do
|
366
|
-
@value.should
|
366
|
+
@value.should eq(123)
|
367
367
|
end
|
368
368
|
end
|
369
369
|
end
|
@@ -1,12 +1,19 @@
|
|
1
1
|
Feature: filters
|
2
2
|
|
3
|
-
`before
|
4
|
-
|
5
|
-
|
6
|
-
given metadata.
|
3
|
+
`before`, `after`, and `around` hooks defined in the block passed to
|
4
|
+
`RSpec.configure` can be constrained to specific examples and/or groups using
|
5
|
+
metadata as a filter.
|
7
6
|
|
8
|
-
|
9
|
-
|
7
|
+
RSpec.configure do |c|
|
8
|
+
c.before(:each, :type => :model) do
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "something", :type => :model do
|
13
|
+
end
|
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`.
|
10
17
|
|
11
18
|
Scenario: filter `before(:each)` hooks using arbitrary metadata
|
12
19
|
Given a file named "filter_before_each_hooks_spec.rb" with:
|
@@ -12,9 +12,11 @@ Feature: User-defined metadata
|
|
12
12
|
behavior in RSpec 3) that allows you to specify metadata using just
|
13
13
|
symbols:
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
```ruby
|
16
|
+
RSpec.configure do |c|
|
17
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
18
|
+
end
|
19
|
+
```
|
18
20
|
|
19
21
|
Each symbol passed as an argument to `describe`, `context` or `it` will
|
20
22
|
be a key in the metadata hash, with a corresponding value of `true`.
|
@@ -24,7 +26,7 @@ Feature: User-defined metadata
|
|
24
26
|
"""
|
25
27
|
describe "a group with user-defined metadata", :foo => 17 do
|
26
28
|
it 'has access to the metadata in the example' do
|
27
|
-
example.metadata[:foo].should
|
29
|
+
example.metadata[:foo].should eq(17)
|
28
30
|
end
|
29
31
|
|
30
32
|
it 'does not have access to metadata defined on sub-groups' do
|
@@ -33,11 +35,11 @@ Feature: User-defined metadata
|
|
33
35
|
|
34
36
|
describe 'a sub-group with user-defined metadata', :bar => 12 do
|
35
37
|
it 'has access to the sub-group metadata' do
|
36
|
-
example.metadata[:foo].should
|
38
|
+
example.metadata[:foo].should eq(17)
|
37
39
|
end
|
38
40
|
|
39
41
|
it 'also has access to metadata defined on parent groups' do
|
40
|
-
example.metadata[:bar].should
|
42
|
+
example.metadata[:bar].should eq(12)
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
@@ -50,13 +52,13 @@ Feature: User-defined metadata
|
|
50
52
|
"""
|
51
53
|
describe "a group with no user-defined metadata" do
|
52
54
|
it 'has an example with metadata', :foo => 17 do
|
53
|
-
example.metadata[:foo].should
|
55
|
+
example.metadata[:foo].should eq(17)
|
54
56
|
example.metadata.should_not include(:bar)
|
55
57
|
end
|
56
58
|
|
57
59
|
it 'has another example with metadata', :bar => 12, :bazz => 33 do
|
58
|
-
example.metadata[:bar].should
|
59
|
-
example.metadata[:bazz].should
|
60
|
+
example.metadata[:bar].should eq(12)
|
61
|
+
example.metadata[:bazz].should eq(33)
|
60
62
|
example.metadata.should_not include(:foo)
|
61
63
|
end
|
62
64
|
end
|
@@ -99,7 +101,7 @@ Feature: User-defined metadata
|
|
99
101
|
end
|
100
102
|
|
101
103
|
it 'can still use a hash for metadata' do
|
102
|
-
example.metadata[:bug].should
|
104
|
+
example.metadata[:bug].should eq(73)
|
103
105
|
end
|
104
106
|
|
105
107
|
it 'can define simple metadata on an example', :special do
|
@@ -77,22 +77,35 @@ Feature: pending examples
|
|
77
77
|
And the output should contain "Expected pending 'something else getting finished' to fail. No Error was raised."
|
78
78
|
And the output should contain "pending_with_passing_block_spec.rb:3"
|
79
79
|
|
80
|
-
Scenario: temporarily pending by
|
81
|
-
Given a file named "
|
80
|
+
Scenario: temporarily pending by prefixing `it`, `specify`, or `example` with an x
|
81
|
+
Given a file named "temporarily_pending_spec.rb" with:
|
82
82
|
"""
|
83
83
|
describe "an example" do
|
84
84
|
xit "is pending using xit" do
|
85
|
-
|
85
|
+
end
|
86
|
+
|
87
|
+
xspecify "is pending using xspecify" do
|
88
|
+
end
|
89
|
+
|
90
|
+
xexample "is pending using xexample" do
|
86
91
|
end
|
87
92
|
end
|
88
93
|
"""
|
89
|
-
When I run `rspec
|
94
|
+
When I run `rspec temporarily_pending_spec.rb`
|
90
95
|
Then the exit status should be 0
|
91
|
-
And the output should contain "
|
96
|
+
And the output should contain "3 examples, 0 failures, 3 pending"
|
92
97
|
And the output should contain:
|
93
98
|
"""
|
94
99
|
Pending:
|
95
100
|
an example is pending using xit
|
101
|
+
# Not Yet Implemented
|
102
|
+
# ./temporarily_pending_spec.rb:2
|
103
|
+
an example is pending using xspecify
|
104
|
+
# Not Yet Implemented
|
105
|
+
# ./temporarily_pending_spec.rb:5
|
106
|
+
an example is pending using xexample
|
107
|
+
# Not Yet Implemented
|
108
|
+
# ./temporarily_pending_spec.rb:8
|
96
109
|
"""
|
97
110
|
|
98
111
|
Scenario: example with no docstring and pending method using documentation formatter
|
@@ -100,7 +113,7 @@ Feature: pending examples
|
|
100
113
|
"""
|
101
114
|
describe "an example" do
|
102
115
|
it "checks something" do
|
103
|
-
(3+4).should
|
116
|
+
(3+4).should eq(7)
|
104
117
|
end
|
105
118
|
specify do
|
106
119
|
pending
|
@@ -122,10 +135,10 @@ Feature: pending examples
|
|
122
135
|
"""
|
123
136
|
describe "an example" do
|
124
137
|
it "checks something" do
|
125
|
-
(3+4).should
|
138
|
+
(3+4).should eq(7)
|
126
139
|
end
|
127
140
|
pending do
|
128
|
-
"string".reverse.should
|
141
|
+
"string".reverse.should eq("gnirts")
|
129
142
|
end
|
130
143
|
end
|
131
144
|
"""
|
@@ -34,7 +34,7 @@ Feature: attribute of subject
|
|
34
34
|
Array
|
35
35
|
when first created
|
36
36
|
size
|
37
|
-
should
|
37
|
+
should eq 0
|
38
38
|
"""
|
39
39
|
|
40
40
|
Scenario: specify value of a nested attribute
|
@@ -65,7 +65,7 @@ Feature: attribute of subject
|
|
65
65
|
Person
|
66
66
|
with one phone number (555-1212)
|
67
67
|
phone_numbers.first
|
68
|
-
should
|
68
|
+
should eq 555-1212
|
69
69
|
"""
|
70
70
|
|
71
71
|
Scenario: specify value of an attribute of a hash
|
data/features/support/env.rb
CHANGED
data/lib/rspec/core.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
$rspec_start_time ||= Time.now
|
1
2
|
require 'rspec/core/dsl'
|
2
3
|
require 'rspec/core/extensions'
|
3
4
|
require 'rspec/core/load_path'
|
@@ -27,8 +28,6 @@ require 'rspec/core/example_group'
|
|
27
28
|
require 'rspec/core/version'
|
28
29
|
require 'rspec/core/errors'
|
29
30
|
|
30
|
-
require 'rspec/autorun' if $0.split(File::SEPARATOR).last == 'rcov'
|
31
|
-
|
32
31
|
module RSpec
|
33
32
|
autoload :Matchers, 'rspec/matchers'
|
34
33
|
|
@@ -75,7 +74,6 @@ module RSpec
|
|
75
74
|
# config.format = 'documentation'
|
76
75
|
# end
|
77
76
|
def self.configure
|
78
|
-
warn_about_deprecated_configure if RSpec.world.example_groups.any?
|
79
77
|
yield configuration if block_given?
|
80
78
|
end
|
81
79
|
|
@@ -83,26 +81,6 @@ module RSpec
|
|
83
81
|
def self.clear_remaining_example_groups
|
84
82
|
world.example_groups.clear
|
85
83
|
end
|
86
|
-
|
87
|
-
private
|
88
|
-
|
89
|
-
def self.warn_about_deprecated_configure
|
90
|
-
warn <<-NOTICE
|
91
|
-
|
92
|
-
*****************************************************************
|
93
|
-
DEPRECATION WARNING: you are using deprecated behaviour that will
|
94
|
-
be removed from RSpec 3.
|
95
|
-
|
96
|
-
You have set some configuration options after an example group has
|
97
|
-
already been defined. In RSpec 3, this will not be allowed. All
|
98
|
-
configuration should happen before the first example group is
|
99
|
-
defined. The configuration is happening at:
|
100
|
-
|
101
|
-
#{caller[1]}
|
102
|
-
*****************************************************************
|
103
|
-
|
104
|
-
NOTICE
|
105
|
-
end
|
106
84
|
end
|
107
85
|
|
108
86
|
require 'rspec/core/backward_compatibility'
|
@@ -6,6 +6,8 @@ module RSpec
|
|
6
6
|
class Configuration
|
7
7
|
include RSpec::Core::Hooks
|
8
8
|
|
9
|
+
class MustBeConfiguredBeforeExampleGroupsError < StandardError; end
|
10
|
+
|
9
11
|
def self.add_setting(name, opts={})
|
10
12
|
if opts[:alias]
|
11
13
|
alias_method name, opts[:alias]
|
@@ -38,6 +40,8 @@ module RSpec
|
|
38
40
|
add_setting :tty
|
39
41
|
add_setting :treat_symbols_as_metadata_keys_with_true_values, :default => false
|
40
42
|
add_setting :expecting_with_rspec
|
43
|
+
add_setting :default_path, :default => 'spec'
|
44
|
+
add_setting :show_failures_in_pending_blocks, :default => false
|
41
45
|
|
42
46
|
CONDITIONAL_FILTERS = {
|
43
47
|
:if => lambda { |value, metadata| metadata.has_key?(:if) && !value },
|
@@ -46,6 +50,7 @@ module RSpec
|
|
46
50
|
|
47
51
|
DEFAULT_BACKTRACE_PATTERNS = [
|
48
52
|
/\/lib\d*\/ruby\//,
|
53
|
+
/org\/jruby\//,
|
49
54
|
/bin\//,
|
50
55
|
/gems/,
|
51
56
|
/spec\/spec_helper\.rb/,
|
@@ -62,6 +67,7 @@ module RSpec
|
|
62
67
|
|
63
68
|
def reset
|
64
69
|
@reporter = nil
|
70
|
+
@formatters.clear if @formatters
|
65
71
|
end
|
66
72
|
|
67
73
|
# :call-seq:
|
@@ -158,6 +164,7 @@ module RSpec
|
|
158
164
|
# teardown_mocks_for_rspec
|
159
165
|
# - called after verify_mocks_for_rspec (even if there are errors)
|
160
166
|
def mock_framework=(framework)
|
167
|
+
assert_no_example_groups_defined(:mock_framework)
|
161
168
|
case framework
|
162
169
|
when Module
|
163
170
|
settings[:mock_framework] = framework
|
@@ -198,6 +205,7 @@ module RSpec
|
|
198
205
|
# Given :stdlib, configures test/unit/assertions
|
199
206
|
# Given both, configures both
|
200
207
|
def expect_with(*frameworks)
|
208
|
+
assert_no_example_groups_defined(:expect_with)
|
201
209
|
settings[:expectation_frameworks] = []
|
202
210
|
frameworks.each do |framework|
|
203
211
|
case framework
|
@@ -252,22 +260,34 @@ module RSpec
|
|
252
260
|
begin
|
253
261
|
require 'ruby-debug'
|
254
262
|
Debugger.start
|
255
|
-
rescue LoadError
|
263
|
+
rescue LoadError => e
|
256
264
|
raise <<-EOM
|
257
265
|
|
258
266
|
#{'*'*50}
|
259
|
-
|
267
|
+
#{e.message}
|
268
|
+
|
269
|
+
If you have it installed as a ruby gem, then you need to either require
|
270
|
+
'rubygems' or configure the RUBYOPT environment variable with the value
|
271
|
+
'rubygems'.
|
260
272
|
|
261
|
-
|
262
|
-
require 'rubygems' or configure the RUBYOPT environment variable with
|
263
|
-
the value 'rubygems'.
|
273
|
+
#{e.backtrace.join("\n")}
|
264
274
|
#{'*'*50}
|
265
275
|
EOM
|
266
276
|
end
|
267
277
|
end
|
268
278
|
|
269
|
-
|
270
|
-
|
279
|
+
# Run examples defined on +line_numbers+ in all files to run.
|
280
|
+
def line_numbers=(line_numbers)
|
281
|
+
filter_run({ :line_numbers => line_numbers.map{|l| l.to_i} }, true)
|
282
|
+
end
|
283
|
+
|
284
|
+
def add_location(file_path, line_numbers)
|
285
|
+
# Filter locations is a hash of expanded paths to arrays of line numbers
|
286
|
+
# to match against.
|
287
|
+
#
|
288
|
+
filter_locations = ((self.filter || {})[:locations] ||= {})
|
289
|
+
(filter_locations[File.expand_path(file_path)] ||= []).push(*line_numbers)
|
290
|
+
filter_run({ :locations => filter_locations })
|
271
291
|
end
|
272
292
|
|
273
293
|
def full_description=(description)
|
@@ -297,15 +317,31 @@ EOM
|
|
297
317
|
end
|
298
318
|
|
299
319
|
def files_or_directories_to_run=(*files)
|
300
|
-
|
320
|
+
files = files.flatten
|
321
|
+
files << default_path if command == 'rspec' && default_path && files.empty?
|
322
|
+
self.files_to_run = get_files_to_run(files)
|
323
|
+
end
|
324
|
+
|
325
|
+
def command
|
326
|
+
$0.split(File::SEPARATOR).last
|
327
|
+
end
|
328
|
+
|
329
|
+
def get_files_to_run(files)
|
330
|
+
patterns = pattern.split(",")
|
331
|
+
files.map do |file|
|
301
332
|
if File.directory?(file)
|
302
|
-
|
303
|
-
|
333
|
+
patterns.map do |pattern|
|
334
|
+
if pattern =~ /^#{file}/
|
335
|
+
Dir[pattern.strip]
|
336
|
+
else
|
337
|
+
Dir["#{file}/{#{pattern.strip}}"]
|
338
|
+
end
|
304
339
|
end
|
305
340
|
else
|
306
|
-
if file =~
|
307
|
-
|
308
|
-
|
341
|
+
if file =~ /^(.*?)((?:\:\d+)+)$/
|
342
|
+
path, lines = $1, $2[1..-1].split(":").map{|n| n.to_i}
|
343
|
+
add_location path, lines
|
344
|
+
path
|
309
345
|
else
|
310
346
|
file
|
311
347
|
end
|
@@ -345,10 +381,12 @@ EOM
|
|
345
381
|
RSpec::Core::ExampleGroup.alias_it_should_behave_like_to(new_name, report_label)
|
346
382
|
end
|
347
383
|
|
384
|
+
undef_method :exclusion_filter=
|
348
385
|
def exclusion_filter=(filter)
|
349
386
|
settings[:exclusion_filter] = filter
|
350
387
|
end
|
351
388
|
|
389
|
+
undef_method :exclusion_filter
|
352
390
|
def exclusion_filter
|
353
391
|
settings[:exclusion_filter] || {}
|
354
392
|
end
|
@@ -360,6 +398,7 @@ EOM
|
|
360
398
|
def inclusion_filter
|
361
399
|
settings[:inclusion_filter] || {}
|
362
400
|
end
|
401
|
+
|
363
402
|
def filter_run_including(*args)
|
364
403
|
force_overwrite = if args.last.is_a?(Hash) || args.last.is_a?(Symbol)
|
365
404
|
false
|
@@ -369,7 +408,7 @@ EOM
|
|
369
408
|
|
370
409
|
options = build_metadata_hash_from(args)
|
371
410
|
|
372
|
-
if inclusion_filter[:
|
411
|
+
if inclusion_filter and inclusion_filter[:line_numbers] || inclusion_filter[:full_description]
|
373
412
|
warn "Filtering by #{options.inspect} is not possible since " \
|
374
413
|
"you are already filtering by #{inclusion_filter.inspect}"
|
375
414
|
else
|
@@ -400,7 +439,7 @@ EOM
|
|
400
439
|
|
401
440
|
def configure_group(group)
|
402
441
|
include_or_extend_modules.each do |include_or_extend, mod, filters|
|
403
|
-
next unless filters.empty? || group.
|
442
|
+
next unless filters.empty? || group.any_apply?(filters)
|
404
443
|
group.send(include_or_extend, mod)
|
405
444
|
end
|
406
445
|
end
|
@@ -422,6 +461,15 @@ EOM
|
|
422
461
|
|
423
462
|
private
|
424
463
|
|
464
|
+
def assert_no_example_groups_defined(config_option)
|
465
|
+
if RSpec.world.example_groups.any?
|
466
|
+
raise MustBeConfiguredBeforeExampleGroupsError.new(
|
467
|
+
"RSpec's #{config_option} configuration option must be configured before " +
|
468
|
+
"any example groups are defined, but you have already defined a group."
|
469
|
+
)
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
425
473
|
def raise_if_rspec_1_is_loaded
|
426
474
|
if defined?(Spec) && defined?(Spec::VERSION::MAJOR) && Spec::VERSION::MAJOR == 1
|
427
475
|
raise <<-MESSAGE
|
@@ -475,7 +523,7 @@ MESSAGE
|
|
475
523
|
end
|
476
524
|
end
|
477
525
|
end
|
478
|
-
|
526
|
+
|
479
527
|
def string_const?(str)
|
480
528
|
str.is_a?(String) && /\A[A-Z][a-zA-Z0-9_:]*\z/ =~ str
|
481
529
|
end
|