rspec-core 2.6.0.rc4 → 2.6.0.rc6
Sign up to get free protection for your applications and to get access to all the features.
- data/features/Changelog.md +8 -0
- data/lib/rspec/core/configuration.rb +14 -12
- data/lib/rspec/core/option_parser.rb +4 -0
- data/lib/rspec/core/version.rb +1 -1
- data/rspec-core.gemspec +0 -1
- data/spec/rspec/core/configuration_spec.rb +67 -70
- data/spec/rspec/core/option_parser_spec.rb +22 -19
- metadata +5 -5
data/features/Changelog.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
### 2.6.0.rc6 / 2011-05-06
|
2
|
+
|
3
|
+
[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.0.rc4...v2.6.0.rc6)
|
4
|
+
|
5
|
+
* Enhancements
|
6
|
+
* Restore --pattern/-P command line option from rspec-1
|
7
|
+
* Support false as well as true in config.full_backtrace= (Andreas Tolf Tolfsen)
|
8
|
+
|
1
9
|
### 2.6.0.rc4 / 2011-05-01
|
2
10
|
|
3
11
|
[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.0.rc2...v2.6.0.rc4)
|
@@ -29,7 +29,8 @@ module RSpec
|
|
29
29
|
add_setting :exclusion_filter
|
30
30
|
add_setting :inclusion_filter
|
31
31
|
add_setting :filter, :alias => :inclusion_filter
|
32
|
-
add_setting :
|
32
|
+
add_setting :pattern, :default => '**/*_spec.rb'
|
33
|
+
add_setting :filename_pattern, :alias => :pattern
|
33
34
|
add_setting :files_to_run
|
34
35
|
add_setting :include_or_extend_modules
|
35
36
|
add_setting :backtrace_clean_patterns
|
@@ -42,18 +43,19 @@ module RSpec
|
|
42
43
|
:unless => lambda { |value| value }
|
43
44
|
}
|
44
45
|
|
46
|
+
DEFAULT_BACKTRACE_PATTERNS = [
|
47
|
+
/\/lib\d*\/ruby\//,
|
48
|
+
/bin\//,
|
49
|
+
/gems/,
|
50
|
+
/spec\/spec_helper\.rb/,
|
51
|
+
/lib\/rspec\/(core|expectations|matchers|mocks)/
|
52
|
+
]
|
53
|
+
|
45
54
|
def initialize
|
46
55
|
@color_enabled = false
|
47
56
|
self.include_or_extend_modules = []
|
48
57
|
self.files_to_run = []
|
49
|
-
self.backtrace_clean_patterns =
|
50
|
-
/\/lib\d*\/ruby\//,
|
51
|
-
/bin\//,
|
52
|
-
/gems/,
|
53
|
-
/spec\/spec_helper\.rb/,
|
54
|
-
/lib\/rspec\/(core|expectations|matchers|mocks)/
|
55
|
-
]
|
56
|
-
|
58
|
+
self.backtrace_clean_patterns = DEFAULT_BACKTRACE_PATTERNS.dup
|
57
59
|
self.exclusion_filter = CONDITIONAL_FILTERS.dup
|
58
60
|
end
|
59
61
|
|
@@ -209,8 +211,8 @@ module RSpec
|
|
209
211
|
end
|
210
212
|
end
|
211
213
|
|
212
|
-
def full_backtrace=(
|
213
|
-
settings[:backtrace_clean_patterns] = []
|
214
|
+
def full_backtrace=(true_or_false)
|
215
|
+
settings[:backtrace_clean_patterns] = true_or_false ? [] : DEFAULT_BACKTRACE_PATTERNS
|
214
216
|
end
|
215
217
|
|
216
218
|
def color_enabled
|
@@ -292,7 +294,7 @@ EOM
|
|
292
294
|
def files_or_directories_to_run=(*files)
|
293
295
|
self.files_to_run = files.flatten.collect do |file|
|
294
296
|
if File.directory?(file)
|
295
|
-
|
297
|
+
pattern.split(",").collect do |pattern|
|
296
298
|
Dir["#{file}/#{pattern.strip}"]
|
297
299
|
end
|
298
300
|
else
|
@@ -86,6 +86,10 @@ module RSpec::Core
|
|
86
86
|
options[:profile_examples] = o
|
87
87
|
end
|
88
88
|
|
89
|
+
parser.on('-P', '--pattern PATTERN', 'Load files those matching this pattern. Default is "spec/**/*_spec.rb"') do |o|
|
90
|
+
options[:pattern] = o
|
91
|
+
end
|
92
|
+
|
89
93
|
parser.on('-r', '--require PATH', 'Require a file') do |path|
|
90
94
|
options[:requires] ||= []
|
91
95
|
options[:requires] << path
|
data/lib/rspec/core/version.rb
CHANGED
data/rspec-core.gemspec
CHANGED
@@ -12,7 +12,6 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = "rspec-core-#{RSpec::Core::Version::STRING}"
|
13
13
|
s.description = "BDD for Ruby. RSpec runner and example groups."
|
14
14
|
|
15
|
-
s.rubygems_version = "1.3.7"
|
16
15
|
s.rubyforge_project = "rspec"
|
17
16
|
|
18
17
|
s.files = `git ls-files`.split("\n")
|
@@ -143,16 +143,14 @@ module RSpec::Core
|
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
-
|
147
|
-
|
146
|
+
describe "#files_to_run" do
|
148
147
|
it "loads files not following pattern if named explicitly" do
|
149
148
|
file = "./spec/rspec/core/resources/a_bar.rb"
|
150
149
|
config.files_or_directories_to_run = file
|
151
150
|
config.files_to_run.should == [file]
|
152
151
|
end
|
153
152
|
|
154
|
-
|
155
|
-
|
153
|
+
context "with default pattern" do
|
156
154
|
it "loads files named _spec.rb" do
|
157
155
|
dir = "./spec/rspec/core/resources"
|
158
156
|
config.files_or_directories_to_run = dir
|
@@ -164,80 +162,70 @@ module RSpec::Core
|
|
164
162
|
config.files_or_directories_to_run = file
|
165
163
|
config.files_to_run.should == [file]
|
166
164
|
end
|
167
|
-
|
168
165
|
end
|
166
|
+
end
|
169
167
|
|
170
|
-
|
168
|
+
%w[pattern= filename_pattern=].each do |setter|
|
169
|
+
describe "##{setter}" do
|
170
|
+
context "with single pattern" do
|
171
|
+
before { config.send(setter, "**/*_foo.rb") }
|
172
|
+
it "loads files following pattern" do
|
173
|
+
file = File.expand_path(File.dirname(__FILE__) + "/resources/a_foo.rb")
|
174
|
+
config.files_or_directories_to_run = file
|
175
|
+
config.files_to_run.should include(file)
|
176
|
+
end
|
171
177
|
|
172
|
-
|
173
|
-
|
174
|
-
|
178
|
+
it "loads files in directories following pattern" do
|
179
|
+
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
180
|
+
config.files_or_directories_to_run = dir
|
181
|
+
config.files_to_run.should include("#{dir}/a_foo.rb")
|
182
|
+
end
|
175
183
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
184
|
+
it "does not load files in directories not following pattern" do
|
185
|
+
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
186
|
+
config.files_or_directories_to_run = dir
|
187
|
+
config.files_to_run.should_not include("#{dir}/a_bar.rb")
|
188
|
+
end
|
180
189
|
end
|
181
190
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
191
|
+
context "with multiple patterns" do
|
192
|
+
it "supports comma separated values" do
|
193
|
+
config.send(setter, "**/*_foo.rb,**/*_bar.rb")
|
194
|
+
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
195
|
+
config.files_or_directories_to_run = dir
|
196
|
+
config.files_to_run.should include("#{dir}/a_foo.rb")
|
197
|
+
config.files_to_run.should include("#{dir}/a_bar.rb")
|
198
|
+
end
|
187
199
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
200
|
+
it "supports comma separated values with spaces" do
|
201
|
+
config.send(setter, "**/*_foo.rb, **/*_bar.rb")
|
202
|
+
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
203
|
+
config.files_or_directories_to_run = dir
|
204
|
+
config.files_to_run.should include("#{dir}/a_foo.rb")
|
205
|
+
config.files_to_run.should include("#{dir}/a_bar.rb")
|
206
|
+
end
|
192
207
|
end
|
193
|
-
|
194
208
|
end
|
209
|
+
end
|
195
210
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
end
|
201
|
-
|
202
|
-
it "supports comma separated values" do
|
203
|
-
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
204
|
-
config.files_or_directories_to_run = dir
|
205
|
-
config.files_to_run.should include("#{dir}/a_foo.rb")
|
206
|
-
config.files_to_run.should include("#{dir}/a_bar.rb")
|
207
|
-
end
|
208
|
-
|
209
|
-
it "supports comma separated values with spaces" do
|
210
|
-
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
211
|
-
config.files_or_directories_to_run = dir
|
212
|
-
config.files_to_run.should include("#{dir}/a_foo.rb")
|
213
|
-
config.files_to_run.should include("#{dir}/a_bar.rb")
|
214
|
-
end
|
215
|
-
|
211
|
+
describe "path with line number" do
|
212
|
+
it "assigns the line number as the filter" do
|
213
|
+
config.files_or_directories_to_run = "path/to/a_spec.rb:37"
|
214
|
+
config.filter.should == {:line_number => 37}
|
216
215
|
end
|
216
|
+
end
|
217
217
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
end
|
224
|
-
|
218
|
+
context "with full_description" do
|
219
|
+
it "overrides :focused" do
|
220
|
+
config.filter_run :focused => true
|
221
|
+
config.full_description = "foo"
|
222
|
+
config.filter.should_not have_key(:focused)
|
225
223
|
end
|
226
224
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
config.full_description = "foo"
|
231
|
-
config.filter.should_not have_key(:focused)
|
232
|
-
end
|
233
|
-
|
234
|
-
it "assigns the example name as the filter on description" do
|
235
|
-
config.full_description = "foo"
|
236
|
-
config.filter.should == {:full_description => /foo/}
|
237
|
-
end
|
238
|
-
|
225
|
+
it "assigns the example name as the filter on description" do
|
226
|
+
config.full_description = "foo"
|
227
|
+
config.filter.should == {:full_description => /foo/}
|
239
228
|
end
|
240
|
-
|
241
229
|
end
|
242
230
|
|
243
231
|
describe "#include" do
|
@@ -306,7 +294,7 @@ module RSpec::Core
|
|
306
294
|
|
307
295
|
end
|
308
296
|
|
309
|
-
describe "run_all_when_everything_filtered?" do
|
297
|
+
describe "#run_all_when_everything_filtered?" do
|
310
298
|
|
311
299
|
it "defaults to false" do
|
312
300
|
config.run_all_when_everything_filtered?.should be_false
|
@@ -407,14 +395,14 @@ module RSpec::Core
|
|
407
395
|
end
|
408
396
|
end
|
409
397
|
|
410
|
-
describe 'formatter=' do
|
398
|
+
describe '#formatter=' do
|
411
399
|
it "delegates to add_formatter (better API for user-facing configuration)" do
|
412
400
|
config.should_receive(:add_formatter).with('these','options')
|
413
401
|
config.add_formatter('these','options')
|
414
402
|
end
|
415
403
|
end
|
416
404
|
|
417
|
-
describe "add_formatter" do
|
405
|
+
describe "#add_formatter" do
|
418
406
|
|
419
407
|
it "adds to the list of formatters" do
|
420
408
|
config.add_formatter :documentation
|
@@ -573,7 +561,7 @@ module RSpec::Core
|
|
573
561
|
end
|
574
562
|
end
|
575
563
|
|
576
|
-
describe "line_number=" do
|
564
|
+
describe "#line_number=" do
|
577
565
|
before { config.stub(:warn) }
|
578
566
|
|
579
567
|
it "sets the line number" do
|
@@ -595,9 +583,18 @@ module RSpec::Core
|
|
595
583
|
end
|
596
584
|
|
597
585
|
describe "#full_backtrace=" do
|
598
|
-
|
599
|
-
|
600
|
-
|
586
|
+
context "given true" do
|
587
|
+
it "clears the backtrace clean patterns" do
|
588
|
+
config.full_backtrace = true
|
589
|
+
config.backtrace_clean_patterns.should == []
|
590
|
+
end
|
591
|
+
end
|
592
|
+
|
593
|
+
context "given false" do
|
594
|
+
it "restores backtrace clean patterns" do
|
595
|
+
config.full_backtrace = false
|
596
|
+
config.backtrace_clean_patterns.should == RSpec::Core::Configuration::DEFAULT_BACKTRACE_PATTERNS
|
597
|
+
end
|
601
598
|
end
|
602
599
|
|
603
600
|
it "doesn't impact other instances of config" do
|
@@ -2,13 +2,10 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module RSpec::Core
|
4
4
|
describe OptionParser do
|
5
|
-
before do
|
6
|
-
RSpec.stub(:deprecate)
|
7
|
-
end
|
8
|
-
|
9
5
|
let(:output_file){ mock File }
|
10
6
|
|
11
7
|
before do
|
8
|
+
RSpec.stub(:deprecate)
|
12
9
|
File.stub(:open).with("foo.txt",'w') { (output_file) }
|
13
10
|
end
|
14
11
|
|
@@ -30,17 +27,12 @@ module RSpec::Core
|
|
30
27
|
end
|
31
28
|
end
|
32
29
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
describe "-f" do
|
41
|
-
it "defines the formatter" do
|
42
|
-
options = Parser.parse!(%w[-f doc])
|
43
|
-
options[:formatters].first.should eq(["doc"])
|
30
|
+
%w[--format -f].each do |option|
|
31
|
+
describe option do
|
32
|
+
it "defines the formatter" do
|
33
|
+
options = Parser.parse!([option, 'doc'])
|
34
|
+
options[:formatters].first.should eq(["doc"])
|
35
|
+
end
|
44
36
|
end
|
45
37
|
end
|
46
38
|
|
@@ -72,10 +64,21 @@ module RSpec::Core
|
|
72
64
|
end
|
73
65
|
end
|
74
66
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
67
|
+
%w[--example -e].each do |option|
|
68
|
+
describe option do
|
69
|
+
it "escapes the arg" do
|
70
|
+
options = Parser.parse!([option, "this (and that)"])
|
71
|
+
"this (and that)".should match(options[:full_description])
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
%w[--pattern -P].each do |option|
|
77
|
+
describe option do
|
78
|
+
it "sets the filename pattern" do
|
79
|
+
options = Parser.parse!([option, 'spec/**/*.spec'])
|
80
|
+
options[:pattern].should eq('spec/**/*.spec')
|
81
|
+
end
|
79
82
|
end
|
80
83
|
end
|
81
84
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15424057
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 6
|
9
9
|
- 0
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 2.6.0.
|
11
|
+
- 6
|
12
|
+
version: 2.6.0.rc6
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Chad Humphries
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-05-
|
21
|
+
date: 2011-05-06 00:00:00 -05:00
|
22
22
|
default_executable:
|
23
23
|
dependencies: []
|
24
24
|
|
@@ -245,7 +245,7 @@ rubyforge_project: rspec
|
|
245
245
|
rubygems_version: 1.6.2
|
246
246
|
signing_key:
|
247
247
|
specification_version: 3
|
248
|
-
summary: rspec-core-2.6.0.
|
248
|
+
summary: rspec-core-2.6.0.rc6
|
249
249
|
test_files:
|
250
250
|
- features/Autotest.md
|
251
251
|
- features/Changelog.md
|