rspec-core 2.7.1 → 2.8.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/features/command_line/order.feature +29 -0
- data/features/command_line/tag.feature +10 -9
- data/features/configuration/default_path.feature +2 -2
- data/features/filtering/exclusion_filters.feature +1 -1
- data/features/filtering/run_all_when_everything_filtered.feature +1 -1
- data/features/subject/attribute_of_subject.feature +1 -1
- data/lib/rspec/core.rb +148 -12
- data/lib/rspec/core/command_line.rb +2 -2
- data/lib/rspec/core/configuration.rb +300 -155
- data/lib/rspec/core/configuration_options.rb +34 -53
- data/lib/rspec/core/deprecation.rb +4 -0
- data/lib/rspec/core/drb_options.rb +72 -0
- data/lib/rspec/core/example.rb +58 -24
- data/lib/rspec/core/example_group.rb +10 -5
- data/lib/rspec/core/extensions.rb +1 -0
- data/lib/rspec/core/extensions/ordered.rb +16 -0
- data/lib/rspec/core/filter_manager.rb +170 -0
- data/lib/rspec/core/formatters/base_formatter.rb +3 -1
- data/lib/rspec/core/formatters/base_text_formatter.rb +6 -0
- data/lib/rspec/core/formatters/snippet_extractor.rb +1 -1
- data/lib/rspec/core/hooks.rb +197 -1
- data/lib/rspec/core/let.rb +3 -2
- data/lib/rspec/core/metadata.rb +25 -4
- data/lib/rspec/core/option_parser.rb +89 -54
- data/lib/rspec/core/pending.rb +41 -0
- data/lib/rspec/core/rake_task.rb +9 -25
- data/lib/rspec/core/reporter.rb +43 -19
- data/lib/rspec/core/shared_context.rb +35 -0
- data/lib/rspec/core/shared_example_group.rb +0 -1
- data/lib/rspec/core/subject.rb +4 -4
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +34 -52
- data/spec/autotest/failed_results_re_spec.rb +2 -2
- data/spec/command_line/order_spec.rb +131 -0
- data/spec/rspec/core/command_line_spec.rb +2 -1
- data/spec/rspec/core/configuration_options_spec.rb +83 -163
- data/spec/rspec/core/configuration_spec.rb +311 -139
- data/spec/rspec/core/drb_options_spec.rb +131 -0
- data/spec/rspec/core/example_group_spec.rb +22 -11
- data/spec/rspec/core/example_spec.rb +1 -2
- data/spec/rspec/core/filter_manager_spec.rb +175 -0
- data/spec/rspec/core/formatters/helpers_spec.rb +1 -1
- data/spec/rspec/core/formatters/html_formatter_spec.rb +3 -2
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +1 -1
- data/spec/rspec/core/metadata_spec.rb +21 -6
- data/spec/rspec/core/option_parser_spec.rb +74 -0
- data/spec/rspec/core/reporter_spec.rb +18 -1
- data/spec/rspec/core/shared_context_spec.rb +54 -17
- data/spec/rspec/core/subject_spec.rb +1 -1
- data/spec/rspec/core/world_spec.rb +7 -188
- data/spec/spec_helper.rb +47 -43
- data/spec/support/config_options_helper.rb +27 -0
- metadata +28 -12
- data/lib/rspec/core/expecting/with_rspec.rb +0 -9
- data/lib/rspec/core/expecting/with_stdlib.rb +0 -9
@@ -0,0 +1,131 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe RSpec::Core::DrbOptions do
|
4
|
+
include ConfigOptionsHelper
|
5
|
+
|
6
|
+
# TODO ensure all options are output
|
7
|
+
describe "#drb_argv" do
|
8
|
+
it "preserves extra arguments" do
|
9
|
+
File.stub(:exist?) { false }
|
10
|
+
config_options_object(*%w[ a --drb b --color c ]).drb_argv.should =~ %w[ --color a b c ]
|
11
|
+
end
|
12
|
+
|
13
|
+
it "includes --fail-fast" do
|
14
|
+
config_options_object(*%w[--fail-fast]).drb_argv.should include("--fail-fast")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "includes --options" do
|
18
|
+
config_options_object(*%w[--options custom.opts]).drb_argv.should include("--options", "custom.opts")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "includes --order" do
|
22
|
+
config_options_object(*%w[--order random]).drb_argv.should include('--order', 'random')
|
23
|
+
end
|
24
|
+
|
25
|
+
context "with --example" do
|
26
|
+
it "includes --example" do
|
27
|
+
config_options_object(*%w[--example foo]).drb_argv.should include("--example", "foo")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "unescapes characters which were escaped upon storing --example originally" do
|
31
|
+
config_options_object("--example", "foo\\ bar").drb_argv.should include("--example", "foo bar")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "with tags" do
|
36
|
+
it "includes the inclusion tags" do
|
37
|
+
coo = config_options_object("--tag", "tag")
|
38
|
+
coo.drb_argv.should eq(["--tag", "tag"])
|
39
|
+
end
|
40
|
+
|
41
|
+
it "includes the inclusion tags with values" do
|
42
|
+
coo = config_options_object("--tag", "tag:foo")
|
43
|
+
coo.drb_argv.should eq(["--tag", "tag:foo"])
|
44
|
+
end
|
45
|
+
|
46
|
+
it "leaves inclusion tags intact" do
|
47
|
+
coo = config_options_object("--tag", "tag")
|
48
|
+
coo.drb_argv
|
49
|
+
coo.filter_manager.inclusions.should eq( {:tag=>true} )
|
50
|
+
end
|
51
|
+
|
52
|
+
it "leaves inclusion tags with values intact" do
|
53
|
+
coo = config_options_object("--tag", "tag:foo")
|
54
|
+
coo.drb_argv
|
55
|
+
coo.filter_manager.inclusions.should eq( {:tag=>'foo'} )
|
56
|
+
end
|
57
|
+
|
58
|
+
it "includes the exclusion tags" do
|
59
|
+
coo = config_options_object("--tag", "~tag")
|
60
|
+
coo.drb_argv.should eq(["--tag", "~tag"])
|
61
|
+
end
|
62
|
+
|
63
|
+
it "includes the exclusion tags with values" do
|
64
|
+
coo = config_options_object("--tag", "~tag:foo")
|
65
|
+
coo.drb_argv.should eq(["--tag", "~tag:foo"])
|
66
|
+
end
|
67
|
+
|
68
|
+
it "leaves exclusion tags intact" do
|
69
|
+
coo = config_options_object("--tag", "~tag")
|
70
|
+
coo.drb_argv
|
71
|
+
coo.filter_manager.exclusions.should include(:tag=>true)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "leaves exclusion tags with values intact" do
|
75
|
+
coo = config_options_object("--tag", "~tag:foo")
|
76
|
+
coo.drb_argv
|
77
|
+
coo.filter_manager.exclusions.should include(:tag=>'foo')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context "with formatters" do
|
82
|
+
it "includes the formatters" do
|
83
|
+
coo = config_options_object("--format", "d")
|
84
|
+
coo.drb_argv.should eq(["--format", "d"])
|
85
|
+
end
|
86
|
+
|
87
|
+
it "leaves formatters intact" do
|
88
|
+
coo = config_options_object("--format", "d")
|
89
|
+
coo.drb_argv
|
90
|
+
coo.options[:formatters].should eq([["d"]])
|
91
|
+
end
|
92
|
+
|
93
|
+
it "leaves output intact" do
|
94
|
+
coo = config_options_object("--format", "p", "--out", "foo.txt", "--format", "d")
|
95
|
+
coo.drb_argv
|
96
|
+
coo.options[:formatters].should eq([["p","foo.txt"],["d"]])
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
context "--drb specified in ARGV" do
|
101
|
+
it "renders all the original arguments except --drb" do
|
102
|
+
config_options_object(*%w[ --drb --color --format s --example pattern --line_number 1 --profile --backtrace -I path/a -I path/b --require path/c --require path/d]).
|
103
|
+
drb_argv.should eq(%w[ --color --profile --backtrace --example pattern --line_number 1 --format s -I path/a -I path/b --require path/c --require path/d])
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
context "--drb specified in the options file" do
|
108
|
+
it "renders all the original arguments except --drb" do
|
109
|
+
File.open("./.rspec", "w") {|f| f << "--drb --color"}
|
110
|
+
config_options_object(*%w[ --tty --format s --example pattern --line_number 1 --profile --backtrace ]).
|
111
|
+
drb_argv.should eq(%w[ --color --profile --backtrace --tty --example pattern --line_number 1 --format s])
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
context "--drb specified in ARGV and the options file" do
|
116
|
+
it "renders all the original arguments except --drb" do
|
117
|
+
File.open("./.rspec", "w") {|f| f << "--drb --color"}
|
118
|
+
config_options_object(*%w[ --drb --format s --example pattern --line_number 1 --profile --backtrace]).
|
119
|
+
drb_argv.should eq(%w[ --color --profile --backtrace --example pattern --line_number 1 --format s])
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
context "--drb specified in ARGV and in as ARGV-specified --options file" do
|
124
|
+
it "renders all the original arguments except --drb and --options" do
|
125
|
+
File.open("./.rspec", "w") {|f| f << "--drb --color"}
|
126
|
+
config_options_object(*%w[ --drb --format s --example pattern --line_number 1 --profile --backtrace]).
|
127
|
+
drb_argv.should eq(%w[ --color --profile --backtrace --example pattern --line_number 1 --format s ])
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -111,7 +111,7 @@ module RSpec::Core
|
|
111
111
|
world = RSpec::Core::World.new
|
112
112
|
parent = ExampleGroup.describe
|
113
113
|
world.register(parent)
|
114
|
-
|
114
|
+
parent.describe
|
115
115
|
world.example_groups.should eq([parent])
|
116
116
|
end
|
117
117
|
end
|
@@ -121,7 +121,11 @@ module RSpec::Core
|
|
121
121
|
|
122
122
|
shared_examples "matching filters" do
|
123
123
|
context "inclusion" do
|
124
|
-
before
|
124
|
+
before do
|
125
|
+
filter_manager = FilterManager.new
|
126
|
+
filter_manager.include filter_metadata
|
127
|
+
world.stub(:filter_manager => filter_manager)
|
128
|
+
end
|
125
129
|
|
126
130
|
it "includes examples in groups matching filter" do
|
127
131
|
group = ExampleGroup.describe("does something", spec_metadata)
|
@@ -145,11 +149,16 @@ module RSpec::Core
|
|
145
149
|
end
|
146
150
|
|
147
151
|
context "exclusion" do
|
148
|
-
before
|
152
|
+
before do
|
153
|
+
filter_manager = FilterManager.new
|
154
|
+
filter_manager.exclude filter_metadata
|
155
|
+
world.stub(:filter_manager => filter_manager)
|
156
|
+
end
|
157
|
+
|
149
158
|
it "excludes examples in groups matching filter" do
|
150
159
|
group = ExampleGroup.describe("does something", spec_metadata)
|
151
160
|
group.stub(:world) { world }
|
152
|
-
|
161
|
+
[ group.example("first"), group.example("second") ]
|
153
162
|
|
154
163
|
group.filtered_examples.should be_empty
|
155
164
|
end
|
@@ -157,7 +166,7 @@ module RSpec::Core
|
|
157
166
|
it "excludes examples directly matching filter" do
|
158
167
|
group = ExampleGroup.describe("does something")
|
159
168
|
group.stub(:world) { world }
|
160
|
-
|
169
|
+
[
|
161
170
|
group.example("first", spec_metadata),
|
162
171
|
group.example("second", spec_metadata)
|
163
172
|
]
|
@@ -245,10 +254,12 @@ module RSpec::Core
|
|
245
254
|
|
246
255
|
context "with no examples or groups that match filters" do
|
247
256
|
it "returns none" do
|
248
|
-
|
257
|
+
filter_manager = FilterManager.new
|
258
|
+
filter_manager.include :awesome => false
|
259
|
+
world.stub(:filter_manager => filter_manager)
|
249
260
|
group = ExampleGroup.describe
|
250
261
|
group.stub(:world) { world }
|
251
|
-
|
262
|
+
group.example("does something")
|
252
263
|
group.filtered_examples.should eq([])
|
253
264
|
end
|
254
265
|
end
|
@@ -683,7 +694,7 @@ module RSpec::Core
|
|
683
694
|
example('ex 1') { 1.should eq(1) }
|
684
695
|
example('ex 2') { 1.should eq(1) }
|
685
696
|
end
|
686
|
-
group.stub(:filtered_examples) { group.examples }
|
697
|
+
group.stub(:filtered_examples) { group.examples.extend(Extensions::Ordered) }
|
687
698
|
group.run(reporter).should be_true
|
688
699
|
end
|
689
700
|
|
@@ -692,7 +703,7 @@ module RSpec::Core
|
|
692
703
|
example('ex 1') { 1.should eq(1) }
|
693
704
|
example('ex 2') { 1.should eq(2) }
|
694
705
|
end
|
695
|
-
group.stub(:filtered_examples) { group.examples }
|
706
|
+
group.stub(:filtered_examples) { group.examples.extend(Extensions::Ordered) }
|
696
707
|
group.run(reporter).should be_false
|
697
708
|
end
|
698
709
|
|
@@ -701,7 +712,7 @@ module RSpec::Core
|
|
701
712
|
example('ex 1') { 1.should eq(2) }
|
702
713
|
example('ex 2') { 1.should eq(1) }
|
703
714
|
end
|
704
|
-
group.stub(:filtered_examples) { group.examples }
|
715
|
+
group.stub(:filtered_examples) { group.examples.extend(Extensions::Ordered) }
|
705
716
|
group.filtered_examples.each do |example|
|
706
717
|
example.should_receive(:run)
|
707
718
|
end
|
@@ -1008,7 +1019,7 @@ module RSpec::Core
|
|
1008
1019
|
eval_count = 0
|
1009
1020
|
shared_examples_for("thing") { |p| eval_count += 1 }
|
1010
1021
|
group = ExampleGroup.describe('fake group')
|
1011
|
-
|
1022
|
+
group.it_should_behave_like("thing", :a)
|
1012
1023
|
eval_count.should eq(1)
|
1013
1024
|
end
|
1014
1025
|
end
|
@@ -103,7 +103,7 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
103
103
|
|
104
104
|
describe "accessing options within a running example" do
|
105
105
|
it "can look up option values by key", :demo => :data do
|
106
|
-
example.
|
106
|
+
example.metadata[:demo].should eq(:data)
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
@@ -285,5 +285,4 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
285
285
|
end
|
286
286
|
|
287
287
|
end
|
288
|
-
|
289
288
|
end
|
@@ -0,0 +1,175 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module RSpec::Core
|
4
|
+
describe FilterManager do
|
5
|
+
%w[inclusions include exclusions exclude].each_slice(2) do |type, name|
|
6
|
+
it "merges #{type}" do
|
7
|
+
filter_manager = FilterManager.new
|
8
|
+
filter_manager.exclusions.clear # defaults
|
9
|
+
filter_manager.send name, :foo => :bar
|
10
|
+
filter_manager.send name, :baz => :bam
|
11
|
+
filter_manager.send(type).should eq(:foo => :bar, :baz => :bam)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "overrides previous #{type} (via merge)" do
|
15
|
+
filter_manager = FilterManager.new
|
16
|
+
filter_manager.exclusions.clear # defaults
|
17
|
+
filter_manager.send name, :foo => 1
|
18
|
+
filter_manager.send name, :foo => 2
|
19
|
+
filter_manager.send(type).should eq(:foo => 2)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "ignores new #{type} if same key exists and priority is low" do
|
23
|
+
filter_manager = FilterManager.new
|
24
|
+
filter_manager.exclusions.clear # defaults
|
25
|
+
filter_manager.send name, :foo => 1
|
26
|
+
filter_manager.send name, :weak, :foo => 2
|
27
|
+
filter_manager.send(type).should eq(:foo => 1)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "#prune" do
|
32
|
+
it "includes objects with tags matching inclusions" do
|
33
|
+
included = RSpec::Core::Metadata.new({:foo => :bar})
|
34
|
+
excluded = RSpec::Core::Metadata.new
|
35
|
+
filter_manager = FilterManager.new
|
36
|
+
filter_manager.include :foo => :bar
|
37
|
+
filter_manager.prune([included, excluded]).should eq([included])
|
38
|
+
end
|
39
|
+
|
40
|
+
it "excludes objects with tags matching exclusions" do
|
41
|
+
included = RSpec::Core::Metadata.new
|
42
|
+
excluded = RSpec::Core::Metadata.new({:foo => :bar})
|
43
|
+
filter_manager = FilterManager.new
|
44
|
+
filter_manager.exclude :foo => :bar
|
45
|
+
filter_manager.prune([included, excluded]).should eq([included])
|
46
|
+
end
|
47
|
+
|
48
|
+
it "prefers exclusion when matches previously set inclusion" do
|
49
|
+
included = RSpec::Core::Metadata.new
|
50
|
+
excluded = RSpec::Core::Metadata.new({:foo => :bar})
|
51
|
+
filter_manager = FilterManager.new
|
52
|
+
filter_manager.include :foo => :bar
|
53
|
+
filter_manager.exclude :foo => :bar
|
54
|
+
filter_manager.prune([included, excluded]).should eq([included])
|
55
|
+
end
|
56
|
+
|
57
|
+
it "prefers inclusion when matches previously set exclusion" do
|
58
|
+
included = RSpec::Core::Metadata.new({:foo => :bar})
|
59
|
+
excluded = RSpec::Core::Metadata.new
|
60
|
+
filter_manager = FilterManager.new
|
61
|
+
filter_manager.exclude :foo => :bar
|
62
|
+
filter_manager.include :foo => :bar
|
63
|
+
filter_manager.prune([included, excluded]).should eq([included])
|
64
|
+
end
|
65
|
+
|
66
|
+
it "prefers previously set inclusion when exclusion matches but has lower priority" do
|
67
|
+
included = RSpec::Core::Metadata.new({:foo => :bar})
|
68
|
+
excluded = RSpec::Core::Metadata.new
|
69
|
+
filter_manager = FilterManager.new
|
70
|
+
filter_manager.include :foo => :bar
|
71
|
+
filter_manager.exclude :low, :foo => :bar
|
72
|
+
filter_manager.prune([included, excluded]).should eq([included])
|
73
|
+
end
|
74
|
+
|
75
|
+
it "prefers previously set exclusion when inclusion matches but has lower priority" do
|
76
|
+
included = RSpec::Core::Metadata.new
|
77
|
+
excluded = RSpec::Core::Metadata.new({:foo => :bar})
|
78
|
+
filter_manager = FilterManager.new
|
79
|
+
filter_manager.exclude :foo => :bar
|
80
|
+
filter_manager.include :low, :foo => :bar
|
81
|
+
filter_manager.prune([included, excluded]).should eq([included])
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "#inclusions#description" do
|
86
|
+
it 'cleans up the description' do
|
87
|
+
project_dir = File.expand_path('.')
|
88
|
+
lambda { }.inspect.should include(project_dir)
|
89
|
+
lambda { }.inspect.should include(' (lambda)') if RUBY_VERSION > '1.9'
|
90
|
+
lambda { }.inspect.should include('0x')
|
91
|
+
|
92
|
+
filter_manager = FilterManager.new
|
93
|
+
filter_manager.include :foo => lambda { }
|
94
|
+
|
95
|
+
filter_manager.inclusions.description.should_not include(project_dir)
|
96
|
+
filter_manager.inclusions.description.should_not include(' (lambda)')
|
97
|
+
filter_manager.inclusions.description.should_not include('0x')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe "#exclusions#description" do
|
102
|
+
it 'cleans up the description' do
|
103
|
+
project_dir = File.expand_path('.')
|
104
|
+
lambda { }.inspect.should include(project_dir)
|
105
|
+
lambda { }.inspect.should include(' (lambda)') if RUBY_VERSION > '1.9'
|
106
|
+
lambda { }.inspect.should include('0x')
|
107
|
+
|
108
|
+
filter_manager = FilterManager.new
|
109
|
+
filter_manager.exclude :foo => lambda { }
|
110
|
+
|
111
|
+
filter_manager.exclusions.description.should_not include(project_dir)
|
112
|
+
filter_manager.exclusions.description.should_not include(' (lambda)')
|
113
|
+
filter_manager.exclusions.description.should_not include('0x')
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'returns `{}` when it only contains the default filters' do
|
117
|
+
filter_manager = FilterManager.new
|
118
|
+
filter_manager.exclusions.description.should eq({}.inspect)
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'includes other filters' do
|
122
|
+
filter_manager = FilterManager.new
|
123
|
+
filter_manager.exclude :foo => :bar
|
124
|
+
filter_manager.exclusions.description.should eq({ :foo => :bar }.inspect)
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'deprecates an overridden :if filter' do
|
128
|
+
RSpec.should_receive(:warn_deprecation).with(/exclude\(:if.*is deprecated/)
|
129
|
+
filter_manager = FilterManager.new
|
130
|
+
filter_manager.exclude :if => :custom_filter
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'deprecates an overridden :unless filter' do
|
134
|
+
RSpec.should_receive(:warn_deprecation).with(/exclude\(:unless.*is deprecated/)
|
135
|
+
filter_manager = FilterManager.new
|
136
|
+
filter_manager.exclude :unless => :custom_filter
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'includes an overriden :if filter' do
|
140
|
+
RSpec.stub(:warn_deprecation)
|
141
|
+
filter_manager = FilterManager.new
|
142
|
+
filter_manager.exclude :if => :custom_filter
|
143
|
+
filter_manager.exclusions.description.should eq({ :if => :custom_filter }.inspect)
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'includes an overriden :unless filter' do
|
147
|
+
RSpec.stub(:warn_deprecation)
|
148
|
+
filter_manager = FilterManager.new
|
149
|
+
filter_manager.exclude :unless => :custom_filter
|
150
|
+
filter_manager.exclusions.description.should eq({ :unless => :custom_filter }.inspect)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
it "clears the inclusion filter on include :line_numbers" do
|
155
|
+
filter_manager = FilterManager.new
|
156
|
+
filter_manager.include :foo => :bar
|
157
|
+
filter_manager.include :line_numbers => [100]
|
158
|
+
filter_manager.inclusions.should eq(:line_numbers => [100])
|
159
|
+
end
|
160
|
+
|
161
|
+
it "clears the inclusion filter on include :locations" do
|
162
|
+
filter_manager = FilterManager.new
|
163
|
+
filter_manager.include :foo => :bar
|
164
|
+
filter_manager.include :locations => { "path/to/file.rb" => [37] }
|
165
|
+
filter_manager.inclusions.should eq(:locations => { "path/to/file.rb" => [37] })
|
166
|
+
end
|
167
|
+
|
168
|
+
it "clears the inclusion filter on include :full_description" do
|
169
|
+
filter_manager = FilterManager.new
|
170
|
+
filter_manager.include :foo => :bar
|
171
|
+
filter_manager.include :full_description => "this and that"
|
172
|
+
filter_manager.inclusions.should eq(:full_description => "this and that")
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'rspec/core/formatters/helpers'
|
3
3
|
|
4
4
|
describe RSpec::Core::Formatters::Helpers do
|
5
|
-
let(:helper) {
|
5
|
+
let(:helper) { Object.new.extend(RSpec::Core::Formatters::Helpers) }
|
6
6
|
|
7
7
|
describe "format seconds" do
|
8
8
|
context "sub second times" do
|
@@ -16,7 +16,7 @@ module RSpec
|
|
16
16
|
|
17
17
|
let(:generated_html) do
|
18
18
|
options = RSpec::Core::ConfigurationOptions.new(
|
19
|
-
%w[spec/rspec/core/resources/formatter_specs.rb --format html]
|
19
|
+
%w[spec/rspec/core/resources/formatter_specs.rb --format html --order default]
|
20
20
|
)
|
21
21
|
options.parse_options
|
22
22
|
err, out = StringIO.new, StringIO.new
|
@@ -49,7 +49,7 @@ module RSpec
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def extract_backtrace_from(doc)
|
52
|
-
|
52
|
+
doc.search("div.backtrace").
|
53
53
|
collect {|e| e.at("pre").inner_html}.
|
54
54
|
collect {|e| e.split("\n")}.flatten.
|
55
55
|
select {|e| e =~ /formatter_specs\.rb/}
|
@@ -72,6 +72,7 @@ module RSpec
|
|
72
72
|
actual_path, actual_line_number, actual_suffix = actual_backtraces[i].split(':')
|
73
73
|
File.expand_path(actual_path).should eq(File.expand_path(expected_path))
|
74
74
|
actual_line_number.should eq(expected_line_number)
|
75
|
+
actual_suffix.should eq(expected_suffix)
|
75
76
|
end
|
76
77
|
end
|
77
78
|
end
|