rspec-core 2.0.0.beta.19 → 2.0.0.beta.20
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Upgrade.markdown +6 -0
- data/VERSION +1 -1
- data/features/example_groups/shared_example_group.feature +44 -7
- data/features/filtering/exclusion_filters.feature +79 -0
- data/features/filtering/inclusion_filters.feature +1 -1
- data/features/hooks/around_hooks.feature +28 -1
- data/features/pending/pending_examples.feature +2 -4
- data/features/spec_files/arbitrary_file_suffix.feature +13 -0
- data/lib/autotest/rspec2.rb +17 -17
- data/lib/rspec/core.rb +2 -2
- data/lib/rspec/core/command_line.rb +2 -1
- data/lib/rspec/core/configuration.rb +23 -9
- data/lib/rspec/core/deprecation.rb +1 -1
- data/lib/rspec/core/example_group.rb +11 -28
- data/lib/rspec/core/extensions.rb +4 -0
- data/lib/rspec/core/extensions/instance_eval_with_args.rb +39 -0
- data/lib/rspec/core/{kernel_extensions.rb → extensions/kernel.rb} +0 -0
- data/lib/rspec/core/extensions/module_eval_with_args.rb +54 -0
- data/lib/rspec/core/{object_extensions.rb → extensions/object.rb} +3 -1
- data/lib/rspec/core/formatters/base_formatter.rb +20 -43
- data/lib/rspec/core/formatters/base_text_formatter.rb +13 -10
- data/lib/rspec/core/formatters/documentation_formatter.rb +4 -4
- data/lib/rspec/core/formatters/html_formatter.rb +4 -4
- data/lib/rspec/core/formatters/progress_formatter.rb +4 -4
- data/lib/rspec/core/rake_task.rb +1 -1
- data/lib/rspec/core/reporter.rb +65 -0
- data/lib/rspec/core/subject.rb +1 -1
- data/lib/rspec/core/world.rb +11 -3
- data/rspec-core.gemspec +26 -14
- data/spec/autotest/failed_results_re_spec.rb +14 -23
- data/spec/autotest/rspec_spec.rb +1 -1
- data/spec/rspec/core/configuration_spec.rb +74 -9
- data/spec/rspec/core/drb_command_line_spec.rb +2 -2
- data/spec/rspec/core/example_group_spec.rb +13 -7
- data/spec/rspec/core/example_spec.rb +4 -4
- data/spec/rspec/core/formatters/html_formatted-1.8.6.html +280 -0
- data/spec/rspec/core/formatters/html_formatter_spec.rb +5 -3
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +3 -3
- data/spec/rspec/core/formatters/snippet_extractor_spec.rb +2 -2
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.6.html +280 -0
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +5 -3
- data/spec/rspec/core/hooks_filtering_spec.rb +104 -0
- data/spec/rspec/core/reporter_spec.rb +34 -0
- data/spec/rspec/core/shared_example_group_spec.rb +22 -2
- data/spec/rspec/core/world_spec.rb +10 -8
- data/spec/rspec/{core/core_spec.rb → core_spec.rb} +0 -0
- data/spec/ruby_forker.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +39 -33
data/lib/rspec/core/world.rb
CHANGED
@@ -25,8 +25,8 @@ module RSpec
|
|
25
25
|
@configuration.exclusion_filter
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
29
|
-
@configuration.
|
28
|
+
def configure_group(group)
|
29
|
+
@configuration.configure_group(group)
|
30
30
|
end
|
31
31
|
|
32
32
|
def shared_example_groups
|
@@ -55,7 +55,7 @@ module RSpec
|
|
55
55
|
|
56
56
|
def announce_inclusion_filter
|
57
57
|
if inclusion_filter
|
58
|
-
if @configuration.run_all_when_everything_filtered? && RSpec.world.example_count
|
58
|
+
if @configuration.run_all_when_everything_filtered? && RSpec.world.example_count.zero?
|
59
59
|
@configuration.reporter.message "No examples were matched by #{inclusion_filter.inspect}, running all"
|
60
60
|
@configuration.clear_inclusion_filter
|
61
61
|
filtered_examples.clear
|
@@ -64,6 +64,14 @@ module RSpec
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
67
|
+
|
68
|
+
def announce_exclusion_filter
|
69
|
+
if exclusion_filter && RSpec.world.example_count.zero?
|
70
|
+
@configuration.reporter.message(
|
71
|
+
"No examples were matched. Perhaps #{exclusion_filter.inspect} is excluding everything?")
|
72
|
+
example_groups.clear
|
73
|
+
end
|
74
|
+
end
|
67
75
|
|
68
76
|
include RSpec::Core::Hooks
|
69
77
|
|
data/rspec-core.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rspec-core}
|
8
|
-
s.version = "2.0.0.beta.
|
8
|
+
s.version = "2.0.0.beta.20"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Chad Humphries", "David Chelimsky"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-08-24}
|
13
13
|
s.default_executable = %q{rspec}
|
14
14
|
s.description = %q{RSpec runner and example groups}
|
15
15
|
s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
|
@@ -42,6 +42,7 @@ Gem::Specification.new do |s|
|
|
42
42
|
"features/example_groups/describe_aliases.feature",
|
43
43
|
"features/example_groups/nested_groups.feature",
|
44
44
|
"features/example_groups/shared_example_group.feature",
|
45
|
+
"features/filtering/exclusion_filters.feature",
|
45
46
|
"features/filtering/inclusion_filters.feature",
|
46
47
|
"features/formatters/custom_formatter.feature",
|
47
48
|
"features/hooks/around_hooks.feature",
|
@@ -53,6 +54,7 @@ Gem::Specification.new do |s|
|
|
53
54
|
"features/mock_framework_integration/use_rr.feature",
|
54
55
|
"features/mock_framework_integration/use_rspec.feature",
|
55
56
|
"features/pending/pending_examples.feature",
|
57
|
+
"features/spec_files/arbitrary_file_suffix.feature",
|
56
58
|
"features/subject/attribute_of_subject.feature",
|
57
59
|
"features/subject/explicit_subject.feature",
|
58
60
|
"features/subject/implicit_subject.feature",
|
@@ -71,6 +73,11 @@ Gem::Specification.new do |s|
|
|
71
73
|
"lib/rspec/core/errors.rb",
|
72
74
|
"lib/rspec/core/example.rb",
|
73
75
|
"lib/rspec/core/example_group.rb",
|
76
|
+
"lib/rspec/core/extensions.rb",
|
77
|
+
"lib/rspec/core/extensions/instance_eval_with_args.rb",
|
78
|
+
"lib/rspec/core/extensions/kernel.rb",
|
79
|
+
"lib/rspec/core/extensions/module_eval_with_args.rb",
|
80
|
+
"lib/rspec/core/extensions/object.rb",
|
74
81
|
"lib/rspec/core/formatters.rb",
|
75
82
|
"lib/rspec/core/formatters/base_formatter.rb",
|
76
83
|
"lib/rspec/core/formatters/base_text_formatter.rb",
|
@@ -81,7 +88,6 @@ Gem::Specification.new do |s|
|
|
81
88
|
"lib/rspec/core/formatters/snippet_extractor.rb",
|
82
89
|
"lib/rspec/core/formatters/text_mate_formatter.rb",
|
83
90
|
"lib/rspec/core/hooks.rb",
|
84
|
-
"lib/rspec/core/kernel_extensions.rb",
|
85
91
|
"lib/rspec/core/let.rb",
|
86
92
|
"lib/rspec/core/load_path.rb",
|
87
93
|
"lib/rspec/core/metadata.rb",
|
@@ -90,10 +96,10 @@ Gem::Specification.new do |s|
|
|
90
96
|
"lib/rspec/core/mocking/with_mocha.rb",
|
91
97
|
"lib/rspec/core/mocking/with_rr.rb",
|
92
98
|
"lib/rspec/core/mocking/with_rspec.rb",
|
93
|
-
"lib/rspec/core/object_extensions.rb",
|
94
99
|
"lib/rspec/core/option_parser.rb",
|
95
100
|
"lib/rspec/core/pending.rb",
|
96
101
|
"lib/rspec/core/rake_task.rb",
|
102
|
+
"lib/rspec/core/reporter.rb",
|
97
103
|
"lib/rspec/core/ruby_project.rb",
|
98
104
|
"lib/rspec/core/runner.rb",
|
99
105
|
"lib/rspec/core/shared_example_group.rb",
|
@@ -111,7 +117,6 @@ Gem::Specification.new do |s|
|
|
111
117
|
"spec/rspec/core/command_line_spec_output.txt",
|
112
118
|
"spec/rspec/core/configuration_options_spec.rb",
|
113
119
|
"spec/rspec/core/configuration_spec.rb",
|
114
|
-
"spec/rspec/core/core_spec.rb",
|
115
120
|
"spec/rspec/core/deprecations_spec.rb",
|
116
121
|
"spec/rspec/core/drb_command_line_spec.rb",
|
117
122
|
"spec/rspec/core/example_group_spec.rb",
|
@@ -120,21 +125,25 @@ Gem::Specification.new do |s|
|
|
120
125
|
"spec/rspec/core/formatters/base_text_formatter_spec.rb",
|
121
126
|
"spec/rspec/core/formatters/documentation_formatter_spec.rb",
|
122
127
|
"spec/rspec/core/formatters/helpers_spec.rb",
|
128
|
+
"spec/rspec/core/formatters/html_formatted-1.8.6.html",
|
123
129
|
"spec/rspec/core/formatters/html_formatted-1.8.7.html",
|
124
130
|
"spec/rspec/core/formatters/html_formatted-1.9.1.html",
|
125
131
|
"spec/rspec/core/formatters/html_formatted-1.9.2.html",
|
126
132
|
"spec/rspec/core/formatters/html_formatter_spec.rb",
|
127
133
|
"spec/rspec/core/formatters/progress_formatter_spec.rb",
|
128
134
|
"spec/rspec/core/formatters/snippet_extractor_spec.rb",
|
135
|
+
"spec/rspec/core/formatters/text_mate_formatted-1.8.6.html",
|
129
136
|
"spec/rspec/core/formatters/text_mate_formatted-1.8.7.html",
|
130
137
|
"spec/rspec/core/formatters/text_mate_formatted-1.9.2.html",
|
131
138
|
"spec/rspec/core/formatters/text_mate_formatter_spec.rb",
|
139
|
+
"spec/rspec/core/hooks_filtering_spec.rb",
|
132
140
|
"spec/rspec/core/hooks_spec.rb",
|
133
141
|
"spec/rspec/core/kernel_extensions_spec.rb",
|
134
142
|
"spec/rspec/core/let_spec.rb",
|
135
143
|
"spec/rspec/core/metadata_spec.rb",
|
136
144
|
"spec/rspec/core/option_parser_spec.rb",
|
137
145
|
"spec/rspec/core/pending_example_spec.rb",
|
146
|
+
"spec/rspec/core/reporter_spec.rb",
|
138
147
|
"spec/rspec/core/resources/a_bar.rb",
|
139
148
|
"spec/rspec/core/resources/a_foo.rb",
|
140
149
|
"spec/rspec/core/resources/a_spec.rb",
|
@@ -146,6 +155,7 @@ Gem::Specification.new do |s|
|
|
146
155
|
"spec/rspec/core/shared_example_group_spec.rb",
|
147
156
|
"spec/rspec/core/subject_spec.rb",
|
148
157
|
"spec/rspec/core/world_spec.rb",
|
158
|
+
"spec/rspec/core_spec.rb",
|
149
159
|
"spec/ruby_forker.rb",
|
150
160
|
"spec/spec_helper.rb",
|
151
161
|
"spec/support/matchers.rb",
|
@@ -154,7 +164,7 @@ Gem::Specification.new do |s|
|
|
154
164
|
s.homepage = %q{http://github.com/rspec/rspec-core}
|
155
165
|
s.post_install_message = %q{**************************************************
|
156
166
|
|
157
|
-
Thank you for installing rspec-core-2.0.0.beta.
|
167
|
+
Thank you for installing rspec-core-2.0.0.beta.20
|
158
168
|
|
159
169
|
Please be sure to look at Upgrade.markdown to see what might have changed
|
160
170
|
since the last release.
|
@@ -165,7 +175,7 @@ Gem::Specification.new do |s|
|
|
165
175
|
s.require_paths = ["lib"]
|
166
176
|
s.rubyforge_project = %q{rspec}
|
167
177
|
s.rubygems_version = %q{1.3.7}
|
168
|
-
s.summary = %q{rspec-core-2.0.0.beta.
|
178
|
+
s.summary = %q{rspec-core-2.0.0.beta.20}
|
169
179
|
s.test_files = [
|
170
180
|
"spec/autotest/failed_results_re_spec.rb",
|
171
181
|
"spec/autotest/rspec_spec.rb",
|
@@ -173,7 +183,6 @@ Gem::Specification.new do |s|
|
|
173
183
|
"spec/rspec/core/command_line_spec.rb",
|
174
184
|
"spec/rspec/core/configuration_options_spec.rb",
|
175
185
|
"spec/rspec/core/configuration_spec.rb",
|
176
|
-
"spec/rspec/core/core_spec.rb",
|
177
186
|
"spec/rspec/core/deprecations_spec.rb",
|
178
187
|
"spec/rspec/core/drb_command_line_spec.rb",
|
179
188
|
"spec/rspec/core/example_group_spec.rb",
|
@@ -186,12 +195,14 @@ Gem::Specification.new do |s|
|
|
186
195
|
"spec/rspec/core/formatters/progress_formatter_spec.rb",
|
187
196
|
"spec/rspec/core/formatters/snippet_extractor_spec.rb",
|
188
197
|
"spec/rspec/core/formatters/text_mate_formatter_spec.rb",
|
198
|
+
"spec/rspec/core/hooks_filtering_spec.rb",
|
189
199
|
"spec/rspec/core/hooks_spec.rb",
|
190
200
|
"spec/rspec/core/kernel_extensions_spec.rb",
|
191
201
|
"spec/rspec/core/let_spec.rb",
|
192
202
|
"spec/rspec/core/metadata_spec.rb",
|
193
203
|
"spec/rspec/core/option_parser_spec.rb",
|
194
204
|
"spec/rspec/core/pending_example_spec.rb",
|
205
|
+
"spec/rspec/core/reporter_spec.rb",
|
195
206
|
"spec/rspec/core/resources/a_bar.rb",
|
196
207
|
"spec/rspec/core/resources/a_foo.rb",
|
197
208
|
"spec/rspec/core/resources/a_spec.rb",
|
@@ -203,6 +214,7 @@ Gem::Specification.new do |s|
|
|
203
214
|
"spec/rspec/core/shared_example_group_spec.rb",
|
204
215
|
"spec/rspec/core/subject_spec.rb",
|
205
216
|
"spec/rspec/core/world_spec.rb",
|
217
|
+
"spec/rspec/core_spec.rb",
|
206
218
|
"spec/ruby_forker.rb",
|
207
219
|
"spec/spec_helper.rb",
|
208
220
|
"spec/support/matchers.rb"
|
@@ -213,19 +225,19 @@ Gem::Specification.new do |s|
|
|
213
225
|
s.specification_version = 3
|
214
226
|
|
215
227
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
216
|
-
s.add_development_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.
|
217
|
-
s.add_development_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.
|
228
|
+
s.add_development_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.20"])
|
229
|
+
s.add_development_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.20"])
|
218
230
|
s.add_development_dependency(%q<cucumber>, [">= 0.5.3"])
|
219
231
|
s.add_development_dependency(%q<autotest>, [">= 4.2.9"])
|
220
232
|
else
|
221
|
-
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.
|
222
|
-
s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.
|
233
|
+
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.20"])
|
234
|
+
s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.20"])
|
223
235
|
s.add_dependency(%q<cucumber>, [">= 0.5.3"])
|
224
236
|
s.add_dependency(%q<autotest>, [">= 4.2.9"])
|
225
237
|
end
|
226
238
|
else
|
227
|
-
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.
|
228
|
-
s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.
|
239
|
+
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.20"])
|
240
|
+
s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.20"])
|
229
241
|
s.add_dependency(%q<cucumber>, [">= 0.5.3"])
|
230
242
|
s.add_dependency(%q<autotest>, [">= 4.2.9"])
|
231
243
|
end
|
@@ -1,31 +1,22 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe "failed_results_re for autotest" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
re =~ "1)\n'other example' FAILED\n\nreason line 1\nreason line 2\n\n(additional info)\n/path.rb:37:\n\n"
|
14
|
-
$1.should == "other example"
|
15
|
-
$2.should == "reason line 1\nreason line 2\n\n(additional info)\n/path.rb:37:"
|
4
|
+
let(:output) { StringIO.new }
|
5
|
+
let(:formatter) { RSpec::Core::Formatters::BaseTextFormatter.new(output) }
|
6
|
+
let(:example_output) do
|
7
|
+
group = RSpec::Core::ExampleGroup.describe("group name")
|
8
|
+
example = group.example("example name") { "this".should eq("that") }
|
9
|
+
group.run_all(formatter)
|
10
|
+
RSpec.configuration.stub(:color_enabled?) { false }
|
11
|
+
formatter.dump_failures
|
12
|
+
output.string
|
16
13
|
end
|
17
|
-
|
18
|
-
it "should match
|
14
|
+
|
15
|
+
it "should match a failure" do
|
19
16
|
re = Autotest::Rspec2.new.failed_results_re
|
20
|
-
re =~
|
21
|
-
$1.should == "
|
22
|
-
$2.should == "
|
17
|
+
re =~ example_output
|
18
|
+
$1.should == "group name example name\n Failure/Error: example = group.example(\"example name\") { \"this\".should eq(\"that\") }"
|
19
|
+
$2.should == "./spec/autotest/failed_results_re_spec.rb"
|
23
20
|
end
|
24
21
|
|
25
|
-
it "should match an Error that doesn't end in Error" do
|
26
|
-
re = Autotest::Rspec2.new.failed_results_re
|
27
|
-
re =~ "1)\nInvalidArgument in 'this example'\nreason\n/path.rb:37:\n\n"
|
28
|
-
$1.should == "this example"
|
29
|
-
$2.should == "reason\n/path.rb:37:"
|
30
|
-
end
|
31
22
|
end
|
data/spec/autotest/rspec_spec.rb
CHANGED
@@ -6,6 +6,14 @@ module RSpec::Core
|
|
6
6
|
|
7
7
|
let(:config) { subject }
|
8
8
|
|
9
|
+
describe "#load_spec_files" do
|
10
|
+
it "loads files using load" do
|
11
|
+
config.files_to_run = ["foo.bar", "blah_spec.rb"]
|
12
|
+
config.should_receive(:load).twice
|
13
|
+
config.load_spec_files
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
9
17
|
describe "#mock_framework_class" do
|
10
18
|
before(:each) do
|
11
19
|
config.stub(:require)
|
@@ -68,19 +76,19 @@ module RSpec::Core
|
|
68
76
|
config.filename_pattern = "**/*_foo.rb"
|
69
77
|
end
|
70
78
|
|
71
|
-
it "
|
79
|
+
it "loads files following pattern" do
|
72
80
|
file = File.expand_path(File.dirname(__FILE__) + "/resources/a_foo.rb")
|
73
81
|
config.files_or_directories_to_run = file
|
74
82
|
config.files_to_run.should include(file)
|
75
83
|
end
|
76
84
|
|
77
|
-
it "
|
85
|
+
it "loads files in directories following pattern" do
|
78
86
|
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
79
87
|
config.files_or_directories_to_run = dir
|
80
88
|
config.files_to_run.should include("#{dir}/a_foo.rb")
|
81
89
|
end
|
82
90
|
|
83
|
-
it "
|
91
|
+
it "does not load files in directories not following pattern" do
|
84
92
|
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
85
93
|
config.files_or_directories_to_run = dir
|
86
94
|
config.files_to_run.should_not include("#{dir}/a_bar.rb")
|
@@ -94,14 +102,14 @@ module RSpec::Core
|
|
94
102
|
config.filename_pattern = "**/*_foo.rb,**/*_bar.rb"
|
95
103
|
end
|
96
104
|
|
97
|
-
it "
|
105
|
+
it "supports comma separated values" do
|
98
106
|
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
99
107
|
config.files_or_directories_to_run = dir
|
100
108
|
config.files_to_run.should include("#{dir}/a_foo.rb")
|
101
109
|
config.files_to_run.should include("#{dir}/a_bar.rb")
|
102
110
|
end
|
103
111
|
|
104
|
-
it "
|
112
|
+
it "supports comma separated values with spaces" do
|
105
113
|
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
106
114
|
config.files_or_directories_to_run = dir
|
107
115
|
config.files_to_run.should include("#{dir}/a_foo.rb")
|
@@ -171,7 +179,7 @@ module RSpec::Core
|
|
171
179
|
end
|
172
180
|
end
|
173
181
|
|
174
|
-
it "
|
182
|
+
it "extends the given module into each matching example group" do
|
175
183
|
RSpec.configure do |c|
|
176
184
|
c.extend(ThatThingISentYou, :magic_key => :extend)
|
177
185
|
end
|
@@ -198,14 +206,14 @@ module RSpec::Core
|
|
198
206
|
context "given true" do
|
199
207
|
context "on windows" do
|
200
208
|
before do
|
201
|
-
@original_host =
|
202
|
-
|
209
|
+
@original_host = RbConfig::CONFIG['host_os']
|
210
|
+
RbConfig::CONFIG['host_os'] = 'mswin'
|
203
211
|
config.stub(:require)
|
204
212
|
config.stub(:warn)
|
205
213
|
end
|
206
214
|
|
207
215
|
after do
|
208
|
-
|
216
|
+
RbConfig::CONFIG['host_os'] = @original_host
|
209
217
|
end
|
210
218
|
|
211
219
|
context "with win32console available" do
|
@@ -281,6 +289,24 @@ module RSpec::Core
|
|
281
289
|
config.filter_run :focus => true
|
282
290
|
config.filter.should eq({:focus => true})
|
283
291
|
end
|
292
|
+
|
293
|
+
it "warns if :line_number is already a filter" do
|
294
|
+
config.filter_run :line_number => 100
|
295
|
+
config.should_receive(:warn).with(
|
296
|
+
"Filtering by {:focus=>true} is not possible since you " \
|
297
|
+
"are already filtering by {:line_number=>100}"
|
298
|
+
)
|
299
|
+
config.filter_run :focus => true
|
300
|
+
end
|
301
|
+
|
302
|
+
it "warns if :full_description is already a filter" do
|
303
|
+
config.filter_run :full_description => 'foo'
|
304
|
+
config.should_receive(:warn).with(
|
305
|
+
"Filtering by {:focus=>true} is not possible since you " \
|
306
|
+
"are already filtering by {:full_description=>\"foo\"}"
|
307
|
+
)
|
308
|
+
config.filter_run :focus => true
|
309
|
+
end
|
284
310
|
end
|
285
311
|
|
286
312
|
describe "#filter_run_excluding" do
|
@@ -291,6 +317,8 @@ module RSpec::Core
|
|
291
317
|
end
|
292
318
|
|
293
319
|
describe "line_number=" do
|
320
|
+
before { config.stub(:warn) }
|
321
|
+
|
294
322
|
it "sets the line number" do
|
295
323
|
config.line_number = '37'
|
296
324
|
config.filter.should == {:line_number => 37}
|
@@ -429,5 +457,42 @@ module RSpec::Core
|
|
429
457
|
end
|
430
458
|
end
|
431
459
|
end
|
460
|
+
|
461
|
+
describe "#configure_group" do
|
462
|
+
it "extends with modules" do
|
463
|
+
mod = Module.new
|
464
|
+
group = ExampleGroup.describe("group", :foo => :bar)
|
465
|
+
|
466
|
+
config.extend(mod, :foo => :bar)
|
467
|
+
config.configure_group(group)
|
468
|
+
group.should be_a(mod)
|
469
|
+
end
|
470
|
+
|
471
|
+
it "includes modules" do
|
472
|
+
mod = Module.new
|
473
|
+
group = ExampleGroup.describe("group", :foo => :bar)
|
474
|
+
|
475
|
+
config.include(mod, :foo => :bar)
|
476
|
+
config.configure_group(group)
|
477
|
+
group.included_modules.should include(mod)
|
478
|
+
end
|
479
|
+
|
480
|
+
it "includes each one before deciding whether to include the next" do
|
481
|
+
mod1 = Module.new do
|
482
|
+
def self.included(host)
|
483
|
+
host.metadata[:foo] = :bar
|
484
|
+
end
|
485
|
+
end
|
486
|
+
mod2 = Module.new
|
487
|
+
|
488
|
+
group = ExampleGroup.describe("group")
|
489
|
+
|
490
|
+
config.include(mod1)
|
491
|
+
config.include(mod2, :foo => :bar)
|
492
|
+
config.configure_group(group)
|
493
|
+
group.included_modules.should include(mod1)
|
494
|
+
group.included_modules.should include(mod2)
|
495
|
+
end
|
496
|
+
end
|
432
497
|
end
|
433
498
|
end
|
@@ -145,12 +145,12 @@ describe "::DRbCommandLine", :ruby => "!jruby" do
|
|
145
145
|
out.read
|
146
146
|
end
|
147
147
|
|
148
|
-
it "
|
148
|
+
it "outputs green colorized text when running with --colour option" do
|
149
149
|
pending "figure out a way to properly sandbox this"
|
150
150
|
run_spec_via_druby.should =~ /\e\[32m/m
|
151
151
|
end
|
152
152
|
|
153
|
-
it "
|
153
|
+
it "outputs red colorized text when running with -c option" do
|
154
154
|
pending "figure out a way to properly sandbox this"
|
155
155
|
run_spec_via_druby.should =~ /\e\[31m/m
|
156
156
|
end
|
@@ -165,6 +165,12 @@ module RSpec::Core
|
|
165
165
|
|
166
166
|
end
|
167
167
|
|
168
|
+
describe '#described_class' do
|
169
|
+
it "is the same as describes" do
|
170
|
+
self.class.described_class.should eq(self.class.describes)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
168
174
|
describe '#description' do
|
169
175
|
|
170
176
|
it "grabs the description from the metadata" do
|
@@ -460,28 +466,28 @@ module RSpec::Core
|
|
460
466
|
@before_each_top_level = 'before_each_top_level'
|
461
467
|
end
|
462
468
|
|
463
|
-
it "
|
469
|
+
it "can access a before each ivar at the same level" do
|
464
470
|
@before_each_top_level.should == 'before_each_top_level'
|
465
471
|
end
|
466
472
|
|
467
|
-
it "
|
473
|
+
it "can access a before all ivar at the same level" do
|
468
474
|
@before_all_top_level.should == 'before_all_top_level'
|
469
475
|
end
|
470
476
|
|
471
|
-
it "
|
477
|
+
it "can access the before all ivars in the before_all_ivars hash", :ruby => 1.8 do
|
472
478
|
example.example_group.before_all_ivars.should include('@before_all_top_level' => 'before_all_top_level')
|
473
479
|
end
|
474
480
|
|
475
|
-
it "
|
481
|
+
it "can access the before all ivars in the before_all_ivars hash", :ruby => 1.9 do
|
476
482
|
example.example_group.before_all_ivars.should include(:@before_all_top_level => 'before_all_top_level')
|
477
483
|
end
|
478
484
|
|
479
485
|
describe "but now I am nested" do
|
480
|
-
it "
|
486
|
+
it "can access a parent example groups before each ivar at a nested level" do
|
481
487
|
@before_each_top_level.should == 'before_each_top_level'
|
482
488
|
end
|
483
489
|
|
484
|
-
it "
|
490
|
+
it "can access a parent example groups before all ivar at a nested level" do
|
485
491
|
@before_all_top_level.should == "before_all_top_level"
|
486
492
|
end
|
487
493
|
|
@@ -550,7 +556,7 @@ module RSpec::Core
|
|
550
556
|
its(:last) { should == 'a' }
|
551
557
|
|
552
558
|
describe '.first' do
|
553
|
-
def subject; super.first; end
|
559
|
+
def subject; super().first; end
|
554
560
|
|
555
561
|
its(:next) { should == 2 }
|
556
562
|
end
|