rspec-core 2.0.0.beta.9 → 2.0.0.beta.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/features/configuration/custom_settings.feature +86 -0
- data/features/formatters/custom_formatter.feature +1 -1
- data/lib/rspec/core.rb +6 -1
- data/lib/rspec/core/backward_compatibility.rb +3 -5
- data/lib/rspec/core/command_line.rb +52 -0
- data/lib/rspec/core/configuration.rb +106 -118
- data/lib/rspec/core/configuration_options.rb +30 -88
- data/lib/rspec/core/deprecation.rb +3 -4
- data/lib/rspec/core/drb_command_line.rb +29 -0
- data/lib/rspec/core/formatters/base_formatter.rb +3 -8
- data/lib/rspec/core/formatters/base_text_formatter.rb +2 -2
- data/lib/rspec/core/formatters/documentation_formatter.rb +2 -2
- data/lib/rspec/core/kernel_extensions.rb +1 -1
- data/lib/rspec/core/metadata.rb +11 -11
- data/lib/rspec/core/option_parser.rb +84 -0
- data/lib/rspec/core/runner.rb +17 -42
- data/lib/rspec/core/world.rb +2 -2
- data/lib/rspec/monkey.rb +1 -0
- data/lib/rspec/monkey/spork/test_framework/rspec.rb +7 -0
- data/rspec-core.gemspec +18 -59
- data/spec/rspec/core/configuration_options_spec.rb +91 -7
- data/spec/rspec/core/configuration_spec.rb +52 -18
- data/spec/rspec/core/deprecations_spec.rb +4 -2
- data/spec/rspec/core/drb_command_line_spec.rb +151 -0
- data/spec/rspec/core/formatters/base_formatter_spec.rb +2 -1
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +1 -2
- data/spec/rspec/core/formatters/documentation_formatter_spec.rb +1 -2
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +1 -2
- data/spec/rspec/core/resources/a_spec.rb +1 -1
- data/spec/rspec/core/runner_spec.rb +38 -27
- data/spec/rspec/core/shared_example_group_spec.rb +1 -1
- data/spec/spec_helper.rb +56 -41
- metadata +17 -58
- data/example_specs/failing/README.txt +0 -7
- data/example_specs/failing/diffing_spec.rb +0 -38
- data/example_specs/failing/failing_implicit_docstrings_example.rb +0 -19
- data/example_specs/failing/failure_in_after.rb +0 -10
- data/example_specs/failing/failure_in_before.rb +0 -10
- data/example_specs/failing/mocking_example.rb +0 -40
- data/example_specs/failing/mocking_with_flexmock.rb +0 -26
- data/example_specs/failing/mocking_with_mocha.rb +0 -25
- data/example_specs/failing/mocking_with_rr.rb +0 -27
- data/example_specs/failing/partial_mock_example.rb +0 -20
- data/example_specs/failing/pending_example.rb +0 -9
- data/example_specs/failing/predicate_example.rb +0 -34
- data/example_specs/failing/raising_example.rb +0 -47
- data/example_specs/failing/spec_helper.rb +0 -1
- data/example_specs/failing/syntax_error_example.rb +0 -7
- data/example_specs/failing/team_spec.rb +0 -43
- data/example_specs/failing/timeout_behaviour.rb +0 -7
- data/example_specs/passing/custom_formatter.rb +0 -12
- data/example_specs/passing/custom_matchers.rb +0 -54
- data/example_specs/passing/dynamic_spec.rb +0 -9
- data/example_specs/passing/file_accessor.rb +0 -19
- data/example_specs/passing/file_accessor_spec.rb +0 -38
- data/example_specs/passing/filtered_formatter.rb +0 -18
- data/example_specs/passing/filtered_formatter_example.rb +0 -31
- data/example_specs/passing/greeter_spec.rb +0 -31
- data/example_specs/passing/helper_method_example.rb +0 -14
- data/example_specs/passing/implicit_docstrings_example.rb +0 -18
- data/example_specs/passing/io_processor.rb +0 -8
- data/example_specs/passing/io_processor_spec.rb +0 -21
- data/example_specs/passing/mocking_example.rb +0 -27
- data/example_specs/passing/multi_threaded_example_group_runner.rb +0 -26
- data/example_specs/passing/nested_classes_example.rb +0 -36
- data/example_specs/passing/options_example.rb +0 -31
- data/example_specs/passing/options_formatter.rb +0 -20
- data/example_specs/passing/partial_mock_example.rb +0 -29
- data/example_specs/passing/pending_example.rb +0 -20
- data/example_specs/passing/predicate_example.rb +0 -27
- data/example_specs/passing/shared_example_group_example.rb +0 -81
- data/example_specs/passing/shared_stack_examples.rb +0 -36
- data/example_specs/passing/spec_helper.rb +0 -1
- data/example_specs/passing/stack.rb +0 -36
- data/example_specs/passing/stack_spec.rb +0 -64
- data/example_specs/passing/stack_spec_with_nested_example_groups.rb +0 -67
- data/example_specs/passing/stubbing_example.rb +0 -69
- data/example_specs/passing/subject_example.rb +0 -45
- data/example_specs/passing/yielding_example.rb +0 -33
- data/example_specs/ruby1.9.compatibility/access_to_constants_spec.rb +0 -85
- data/example_specs/spec_helper.rb +0 -10
- data/features/configuration/custom_options.feature +0 -71
data/lib/rspec/core/world.rb
CHANGED
@@ -59,11 +59,11 @@ module RSpec
|
|
59
59
|
def announce_inclusion_filter
|
60
60
|
if inclusion_filter
|
61
61
|
if RSpec.configuration.run_all_when_everything_filtered? && RSpec.world.example_count == 0
|
62
|
-
RSpec.configuration.puts "No examples were matched by #{inclusion_filter.inspect}, running all"
|
62
|
+
RSpec.configuration.output_stream.puts "No examples were matched by #{inclusion_filter.inspect}, running all"
|
63
63
|
RSpec.configuration.clear_inclusion_filter
|
64
64
|
filtered_examples.clear
|
65
65
|
else
|
66
|
-
RSpec.configuration.puts "Run filtered using #{inclusion_filter.inspect}"
|
66
|
+
RSpec.configuration.output_stream.puts "Run filtered using #{inclusion_filter.inspect}"
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
data/lib/rspec/monkey.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "rspec/monkey/spork/test_framework/rspec.rb"
|
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.10"
|
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-06-02}
|
13
13
|
s.description = %q{RSpec runner and example group classes}
|
14
14
|
s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
|
15
15
|
s.executables = ["rspec", "spec"]
|
@@ -31,58 +31,10 @@ Gem::Specification.new do |s|
|
|
31
31
|
"bin/rspec",
|
32
32
|
"bin/spec",
|
33
33
|
"cucumber.yml",
|
34
|
-
"example_specs/failing/README.txt",
|
35
|
-
"example_specs/failing/diffing_spec.rb",
|
36
|
-
"example_specs/failing/failing_implicit_docstrings_example.rb",
|
37
|
-
"example_specs/failing/failure_in_after.rb",
|
38
|
-
"example_specs/failing/failure_in_before.rb",
|
39
|
-
"example_specs/failing/mocking_example.rb",
|
40
|
-
"example_specs/failing/mocking_with_flexmock.rb",
|
41
|
-
"example_specs/failing/mocking_with_mocha.rb",
|
42
|
-
"example_specs/failing/mocking_with_rr.rb",
|
43
|
-
"example_specs/failing/partial_mock_example.rb",
|
44
|
-
"example_specs/failing/pending_example.rb",
|
45
|
-
"example_specs/failing/predicate_example.rb",
|
46
|
-
"example_specs/failing/raising_example.rb",
|
47
|
-
"example_specs/failing/spec_helper.rb",
|
48
|
-
"example_specs/failing/syntax_error_example.rb",
|
49
|
-
"example_specs/failing/team_spec.rb",
|
50
|
-
"example_specs/failing/timeout_behaviour.rb",
|
51
|
-
"example_specs/passing/custom_formatter.rb",
|
52
|
-
"example_specs/passing/custom_matchers.rb",
|
53
|
-
"example_specs/passing/dynamic_spec.rb",
|
54
|
-
"example_specs/passing/file_accessor.rb",
|
55
|
-
"example_specs/passing/file_accessor_spec.rb",
|
56
|
-
"example_specs/passing/filtered_formatter.rb",
|
57
|
-
"example_specs/passing/filtered_formatter_example.rb",
|
58
|
-
"example_specs/passing/greeter_spec.rb",
|
59
|
-
"example_specs/passing/helper_method_example.rb",
|
60
|
-
"example_specs/passing/implicit_docstrings_example.rb",
|
61
|
-
"example_specs/passing/io_processor.rb",
|
62
|
-
"example_specs/passing/io_processor_spec.rb",
|
63
|
-
"example_specs/passing/mocking_example.rb",
|
64
|
-
"example_specs/passing/multi_threaded_example_group_runner.rb",
|
65
|
-
"example_specs/passing/nested_classes_example.rb",
|
66
|
-
"example_specs/passing/options_example.rb",
|
67
|
-
"example_specs/passing/options_formatter.rb",
|
68
|
-
"example_specs/passing/partial_mock_example.rb",
|
69
|
-
"example_specs/passing/pending_example.rb",
|
70
|
-
"example_specs/passing/predicate_example.rb",
|
71
|
-
"example_specs/passing/shared_example_group_example.rb",
|
72
|
-
"example_specs/passing/shared_stack_examples.rb",
|
73
|
-
"example_specs/passing/spec_helper.rb",
|
74
|
-
"example_specs/passing/stack.rb",
|
75
|
-
"example_specs/passing/stack_spec.rb",
|
76
|
-
"example_specs/passing/stack_spec_with_nested_example_groups.rb",
|
77
|
-
"example_specs/passing/stubbing_example.rb",
|
78
|
-
"example_specs/passing/subject_example.rb",
|
79
|
-
"example_specs/passing/yielding_example.rb",
|
80
|
-
"example_specs/ruby1.9.compatibility/access_to_constants_spec.rb",
|
81
|
-
"example_specs/spec_helper.rb",
|
82
34
|
"features/command_line/example_name_option.feature",
|
83
35
|
"features/command_line/line_number_appended_to_path.feature",
|
84
36
|
"features/command_line/line_number_option.feature",
|
85
|
-
"features/configuration/
|
37
|
+
"features/configuration/custom_settings.feature",
|
86
38
|
"features/configuration/options_file.feature",
|
87
39
|
"features/example_groups/describe_aliases.feature",
|
88
40
|
"features/example_groups/nested_groups.feature",
|
@@ -105,9 +57,11 @@ Gem::Specification.new do |s|
|
|
105
57
|
"lib/rspec/core.rb",
|
106
58
|
"lib/rspec/core/around_proxy.rb",
|
107
59
|
"lib/rspec/core/backward_compatibility.rb",
|
60
|
+
"lib/rspec/core/command_line.rb",
|
108
61
|
"lib/rspec/core/configuration.rb",
|
109
62
|
"lib/rspec/core/configuration_options.rb",
|
110
63
|
"lib/rspec/core/deprecation.rb",
|
64
|
+
"lib/rspec/core/drb_command_line.rb",
|
111
65
|
"lib/rspec/core/errors.rb",
|
112
66
|
"lib/rspec/core/example.rb",
|
113
67
|
"lib/rspec/core/example_group.rb",
|
@@ -128,6 +82,7 @@ Gem::Specification.new do |s|
|
|
128
82
|
"lib/rspec/core/mocking/with_rr.rb",
|
129
83
|
"lib/rspec/core/mocking/with_rspec.rb",
|
130
84
|
"lib/rspec/core/object_extensions.rb",
|
85
|
+
"lib/rspec/core/option_parser.rb",
|
131
86
|
"lib/rspec/core/pending.rb",
|
132
87
|
"lib/rspec/core/rake_task.rb",
|
133
88
|
"lib/rspec/core/ruby_project.rb",
|
@@ -136,6 +91,8 @@ Gem::Specification.new do |s|
|
|
136
91
|
"lib/rspec/core/subject.rb",
|
137
92
|
"lib/rspec/core/version.rb",
|
138
93
|
"lib/rspec/core/world.rb",
|
94
|
+
"lib/rspec/monkey.rb",
|
95
|
+
"lib/rspec/monkey/spork/test_framework/rspec.rb",
|
139
96
|
"rspec-core.gemspec",
|
140
97
|
"script/console",
|
141
98
|
"spec/autotest/failed_results_re_spec.rb",
|
@@ -143,6 +100,7 @@ Gem::Specification.new do |s|
|
|
143
100
|
"spec/rspec/core/configuration_options_spec.rb",
|
144
101
|
"spec/rspec/core/configuration_spec.rb",
|
145
102
|
"spec/rspec/core/deprecations_spec.rb",
|
103
|
+
"spec/rspec/core/drb_command_line_spec.rb",
|
146
104
|
"spec/rspec/core/example_group_spec.rb",
|
147
105
|
"spec/rspec/core/example_spec.rb",
|
148
106
|
"spec/rspec/core/formatters/base_formatter_spec.rb",
|
@@ -173,7 +131,7 @@ Gem::Specification.new do |s|
|
|
173
131
|
s.homepage = %q{http://github.com/rspec/core}
|
174
132
|
s.post_install_message = %q{**************************************************
|
175
133
|
|
176
|
-
Thank you for installing rspec-core-2.0.0.beta.
|
134
|
+
Thank you for installing rspec-core-2.0.0.beta.10
|
177
135
|
|
178
136
|
This is beta software. If you are looking
|
179
137
|
for a supported production release, please
|
@@ -185,13 +143,14 @@ Gem::Specification.new do |s|
|
|
185
143
|
s.require_paths = ["lib"]
|
186
144
|
s.rubyforge_project = %q{rspec}
|
187
145
|
s.rubygems_version = %q{1.3.6}
|
188
|
-
s.summary = %q{rspec-core-2.0.0.beta.
|
146
|
+
s.summary = %q{rspec-core-2.0.0.beta.10}
|
189
147
|
s.test_files = [
|
190
148
|
"spec/autotest/failed_results_re_spec.rb",
|
191
149
|
"spec/autotest/rspec_spec.rb",
|
192
150
|
"spec/rspec/core/configuration_options_spec.rb",
|
193
151
|
"spec/rspec/core/configuration_spec.rb",
|
194
152
|
"spec/rspec/core/deprecations_spec.rb",
|
153
|
+
"spec/rspec/core/drb_command_line_spec.rb",
|
195
154
|
"spec/rspec/core/example_group_spec.rb",
|
196
155
|
"spec/rspec/core/example_spec.rb",
|
197
156
|
"spec/rspec/core/formatters/base_formatter_spec.rb",
|
@@ -224,19 +183,19 @@ Gem::Specification.new do |s|
|
|
224
183
|
s.specification_version = 3
|
225
184
|
|
226
185
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
227
|
-
s.add_development_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.
|
228
|
-
s.add_development_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.
|
186
|
+
s.add_development_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.10"])
|
187
|
+
s.add_development_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.10"])
|
229
188
|
s.add_development_dependency(%q<cucumber>, [">= 0.5.3"])
|
230
189
|
s.add_development_dependency(%q<autotest>, [">= 4.2.9"])
|
231
190
|
else
|
232
|
-
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.
|
233
|
-
s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.
|
191
|
+
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.10"])
|
192
|
+
s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.10"])
|
234
193
|
s.add_dependency(%q<cucumber>, [">= 0.5.3"])
|
235
194
|
s.add_dependency(%q<autotest>, [">= 4.2.9"])
|
236
195
|
end
|
237
196
|
else
|
238
|
-
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.
|
239
|
-
s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.
|
197
|
+
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.10"])
|
198
|
+
s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.10"])
|
240
199
|
s.add_dependency(%q<cucumber>, [">= 0.5.3"])
|
241
200
|
s.add_dependency(%q<autotest>, [">= 4.2.9"])
|
242
201
|
end
|
@@ -1,10 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
|
2
3
|
require 'ostruct'
|
3
4
|
|
4
5
|
describe RSpec::Core::ConfigurationOptions do
|
5
6
|
|
7
|
+
def config_options_object(*args)
|
8
|
+
RSpec::Core::ConfigurationOptions.new(args)
|
9
|
+
end
|
10
|
+
|
6
11
|
def options_from_args(*args)
|
7
|
-
|
12
|
+
config_options_object(*args).options
|
8
13
|
end
|
9
14
|
|
10
15
|
describe 'color_enabled' do
|
@@ -102,6 +107,86 @@ describe RSpec::Core::ConfigurationOptions do
|
|
102
107
|
options_from_args("-d").should include(:debug => true)
|
103
108
|
end
|
104
109
|
end
|
110
|
+
|
111
|
+
describe "--drb (-X)" do
|
112
|
+
context "combined with --debug" do
|
113
|
+
it "turns off the debugger if --drb is specified first" do
|
114
|
+
config_options_object("--drb", "--debug").drb_argv.should_not include("--debug")
|
115
|
+
config_options_object("--drb", "-d" ).drb_argv.should_not include("--debug")
|
116
|
+
config_options_object("-X", "--debug").drb_argv.should_not include("--debug")
|
117
|
+
config_options_object("-X", "-d" ).drb_argv.should_not include("--debug")
|
118
|
+
end
|
119
|
+
|
120
|
+
it "turns off the debugger option if --drb is specified later" do
|
121
|
+
config_options_object("--debug", "--drb").drb_argv.should_not include("--debug")
|
122
|
+
config_options_object("-d", "--drb").drb_argv.should_not include("--debug")
|
123
|
+
config_options_object("--debug", "-X" ).drb_argv.should_not include("--debug")
|
124
|
+
config_options_object("-d", "-X" ).drb_argv.should_not include("--debug")
|
125
|
+
end
|
126
|
+
|
127
|
+
it "turns off the debugger option if --drb is specified in the options file" do
|
128
|
+
File.stub(:exist?) { true }
|
129
|
+
File.stub(:readlines) { %w[ --drb ] }
|
130
|
+
config_options_object("--debug").drb_argv.should_not include("--debug")
|
131
|
+
config_options_object("-d" ).drb_argv.should_not include("--debug")
|
132
|
+
end
|
133
|
+
|
134
|
+
it "turns off the debugger option if --debug is specified in the options file" do
|
135
|
+
File.stub(:exist?) { true }
|
136
|
+
File.stub(:readlines) { %w[ --debug ] }
|
137
|
+
config_options_object("--drb").drb_argv.should_not include("--debug")
|
138
|
+
config_options_object("-X" ).drb_argv.should_not include("--debug")
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
it "sends all the arguments other than --drb back to the parser after parsing options" do
|
143
|
+
config_options_object("--drb", "--color").drb_argv.should_not include("--drb")
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
|
148
|
+
# TODO #drb_argv may not be the best name
|
149
|
+
# TODO ensure all options are output
|
150
|
+
# TODO check if we need to spec that the short options are "expanded" ("-v" becomes "--version" currently)
|
151
|
+
describe "#drb_argv" do
|
152
|
+
it "preserves extra arguments" do
|
153
|
+
config_options_object(*%w[ a --drb b --color c ]).drb_argv.should eq(%w[ --color a b c ])
|
154
|
+
end
|
155
|
+
|
156
|
+
context "--drb specified in ARGV" do
|
157
|
+
it "renders all the original arguments except --drb" do
|
158
|
+
config_options_object(*%w[ --drb --color --formatter s --line_number 1 --example pattern --profile --backtrace]).
|
159
|
+
drb_argv.should eq(%w[ --color --profile --backtrace --formatter s --line_number 1 --example pattern ])
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
context "--drb specified in the options file" do
|
164
|
+
it "renders all the original arguments except --drb" do
|
165
|
+
File.stub(:exist?) { true }
|
166
|
+
File.stub(:readlines) { %w[ --drb --color ] }
|
167
|
+
config_options_object(*%w[ --formatter s --line_number 1 --example pattern --profile --backtrace ]).
|
168
|
+
drb_argv.should eq(%w[ --color --profile --backtrace --formatter s --line_number 1 --example pattern ])
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
context "--drb specified in ARGV and the options file" do
|
173
|
+
it "renders all the original arguments except --drb" do
|
174
|
+
File.stub(:exist?) { true }
|
175
|
+
File.stub(:readlines) { %w[ --drb --color ] }
|
176
|
+
config_options_object(*%w[ --drb --formatter s --line_number 1 --example pattern --profile --backtrace]).
|
177
|
+
drb_argv.should eq(%w[ --color --profile --backtrace --formatter s --line_number 1 --example pattern ])
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
context "--drb specified in ARGV and in as ARGV-specified --options file" do
|
182
|
+
it "renders all the original arguments except --drb and --options" do
|
183
|
+
File.stub(:exist?) { true }
|
184
|
+
File.stub(:readlines) { %w[ --drb --color ] }
|
185
|
+
config_options_object(*%w[ --drb --formatter s --line_number 1 --example pattern --profile --backtrace]).
|
186
|
+
drb_argv.should eq(%w[ --color --profile --backtrace --formatter s --line_number 1 --example pattern ])
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
105
190
|
|
106
191
|
describe "options file (override)" do
|
107
192
|
let(:config) { OpenStruct.new }
|
@@ -111,7 +196,7 @@ describe RSpec::Core::ConfigurationOptions do
|
|
111
196
|
File.stub(:readlines) { ["--formatter", "doc"] }
|
112
197
|
|
113
198
|
cli_options = RSpec::Core::ConfigurationOptions.new([])
|
114
|
-
cli_options.
|
199
|
+
cli_options.configure(config)
|
115
200
|
config.formatter.should == 'doc'
|
116
201
|
end
|
117
202
|
|
@@ -120,7 +205,7 @@ describe RSpec::Core::ConfigurationOptions do
|
|
120
205
|
File.stub(:readlines) { ["--formatter doc"] }
|
121
206
|
|
122
207
|
cli_options = RSpec::Core::ConfigurationOptions.new([])
|
123
|
-
cli_options.
|
208
|
+
cli_options.configure(config)
|
124
209
|
config.formatter.should == 'doc'
|
125
210
|
end
|
126
211
|
|
@@ -138,7 +223,7 @@ describe RSpec::Core::ConfigurationOptions do
|
|
138
223
|
end
|
139
224
|
cli_options = RSpec::Core::ConfigurationOptions.new(["--no-color"])
|
140
225
|
|
141
|
-
cli_options.
|
226
|
+
cli_options.configure(config)
|
142
227
|
|
143
228
|
config.formatter.should == "documentation"
|
144
229
|
config.line_number.should == "37"
|
@@ -159,7 +244,7 @@ describe RSpec::Core::ConfigurationOptions do
|
|
159
244
|
end
|
160
245
|
cli_options = RSpec::Core::ConfigurationOptions.new([])
|
161
246
|
|
162
|
-
cli_options.
|
247
|
+
cli_options.configure(config)
|
163
248
|
|
164
249
|
config.formatter.should == "local"
|
165
250
|
end
|
@@ -168,11 +253,10 @@ describe RSpec::Core::ConfigurationOptions do
|
|
168
253
|
config_options = RSpec::Core::ConfigurationOptions.new(['--formatter', 'progress'])
|
169
254
|
config_options.stub(:parse_options_file).and_return(:formatter => 'documentation')
|
170
255
|
|
171
|
-
config_options.
|
256
|
+
config_options.configure(config)
|
172
257
|
|
173
258
|
config.formatter.should == 'progress'
|
174
259
|
end
|
175
260
|
end
|
176
|
-
|
177
261
|
end
|
178
262
|
|
@@ -6,10 +6,6 @@ module RSpec::Core
|
|
6
6
|
|
7
7
|
let(:config) { subject }
|
8
8
|
|
9
|
-
before(:each) do
|
10
|
-
RSpec.world.stub(:configuration).and_return(config)
|
11
|
-
end
|
12
|
-
|
13
9
|
describe "#mock_framework_class" do
|
14
10
|
before(:each) do
|
15
11
|
config.stub(:require)
|
@@ -221,6 +217,14 @@ module RSpec::Core
|
|
221
217
|
end
|
222
218
|
|
223
219
|
describe "full_backtrace=" do
|
220
|
+
before do
|
221
|
+
@backtrace_clean_patterns = config.backtrace_clean_patterns
|
222
|
+
end
|
223
|
+
|
224
|
+
after do
|
225
|
+
config.backtrace_clean_patterns = @backtrace_clean_patterns
|
226
|
+
end
|
227
|
+
|
224
228
|
it "clears the backtrace clean patterns" do
|
225
229
|
config.full_backtrace = true
|
226
230
|
config.backtrace_clean_patterns.should == []
|
@@ -240,6 +244,14 @@ module RSpec::Core
|
|
240
244
|
config.debug = false
|
241
245
|
end
|
242
246
|
end
|
247
|
+
|
248
|
+
describe "#output=" do
|
249
|
+
it "sets the output" do
|
250
|
+
output = mock("output")
|
251
|
+
config.output = output
|
252
|
+
config.output.should equal(output)
|
253
|
+
end
|
254
|
+
end
|
243
255
|
|
244
256
|
describe "libs=" do
|
245
257
|
it "adds directories to the LOAD_PATH" do
|
@@ -248,13 +260,13 @@ module RSpec::Core
|
|
248
260
|
end
|
249
261
|
end
|
250
262
|
|
251
|
-
describe "#
|
252
|
-
describe "
|
263
|
+
describe "#add_setting" do
|
264
|
+
describe "with no modifiers" do
|
253
265
|
context "with no additional options" do
|
254
|
-
before { config.
|
266
|
+
before { config.add_setting :custom_option }
|
255
267
|
|
256
|
-
it "defaults to
|
257
|
-
config.custom_option.should
|
268
|
+
it "defaults to nil" do
|
269
|
+
config.custom_option.should be_nil
|
258
270
|
end
|
259
271
|
|
260
272
|
it "adds a predicate" do
|
@@ -262,28 +274,50 @@ module RSpec::Core
|
|
262
274
|
end
|
263
275
|
|
264
276
|
it "can be overridden" do
|
265
|
-
config.custom_option =
|
266
|
-
config.custom_option.should
|
277
|
+
config.custom_option = "a value"
|
278
|
+
config.custom_option.should eq("a value")
|
267
279
|
end
|
268
280
|
end
|
269
281
|
|
270
|
-
context "with :default =>
|
271
|
-
before { config.
|
282
|
+
context "with :default => 'a value'" do
|
283
|
+
before { config.add_setting :custom_option, :default => 'a value' }
|
272
284
|
|
273
|
-
it "defaults to
|
274
|
-
config.custom_option.should
|
285
|
+
it "defaults to 'a value'" do
|
286
|
+
config.custom_option.should eq("a value")
|
275
287
|
end
|
276
288
|
|
277
|
-
it "
|
289
|
+
it "returns true for the predicate" do
|
278
290
|
config.custom_option?.should be_true
|
279
291
|
end
|
280
292
|
|
281
293
|
it "can be overridden" do
|
282
|
-
config.custom_option =
|
283
|
-
config.custom_option.should
|
294
|
+
config.custom_option = "a new value"
|
295
|
+
config.custom_option.should eq("a new value")
|
284
296
|
end
|
285
297
|
end
|
286
298
|
end
|
299
|
+
|
300
|
+
context "with :alias => " do
|
301
|
+
before do
|
302
|
+
config.add_setting :custom_option
|
303
|
+
config.add_setting :another_custom_option, :alias => :custom_option
|
304
|
+
end
|
305
|
+
|
306
|
+
it "delegates the getter to the other option" do
|
307
|
+
config.another_custom_option = "this value"
|
308
|
+
config.custom_option.should == "this value"
|
309
|
+
end
|
310
|
+
|
311
|
+
it "delegates the setter to the other option" do
|
312
|
+
config.custom_option = "this value"
|
313
|
+
config.another_custom_option.should == "this value"
|
314
|
+
end
|
315
|
+
|
316
|
+
it "delegates the predicate to the other option" do
|
317
|
+
config.custom_option = true
|
318
|
+
config.another_custom_option?.should be_true
|
319
|
+
end
|
320
|
+
end
|
287
321
|
end
|
288
322
|
|
289
323
|
end
|