dchelimsky-rspec 1.1.11.1 → 1.1.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +11 -3
- data/Manifest.txt +35 -46
- data/README.txt +30 -12
- data/Rakefile +9 -9
- data/{stories/configuration/before_blocks.story → features/configuration/before_blocks.feature} +2 -2
- data/{stories/example_groups/autogenerated_docstrings → features/example_groups/autogenerated_docstrings.feature} +1 -1
- data/{stories/example_groups/example_group_with_should_methods → features/example_groups/example_group_with_should_methods.feature} +3 -3
- data/{stories/example_groups/nested_groups → features/example_groups/nested_groups.feature} +1 -1
- data/{stories/example_groups/output → features/example_groups/output.feature} +3 -8
- data/{stories/interop/examples_and_tests_together → features/interop/examples_and_tests_together.feature} +5 -4
- data/{stories/interop/test_but_not_test_unit → features/interop/test_but_not_test_unit.feature} +2 -2
- data/{stories/interop/test_case_with_should_methods → features/interop/test_case_with_should_methods.feature} +2 -2
- data/{stories/mock_framework_integration/use_flexmock.story → features/mock_framework_integration/use_flexmock.feature} +1 -1
- data/features/step_definitions/running_rspec.rb +48 -0
- data/features/support/env.rb +25 -0
- data/{stories/resources → features/support}/helpers/cmdline.rb +0 -0
- data/{stories/resources → features/support}/helpers/story_helper.rb +0 -0
- data/{stories/resources → features/support}/matchers/smart_match.rb +0 -0
- data/{plugins → lib/adapters}/mock_frameworks/flexmock.rb +0 -0
- data/{plugins → lib/adapters}/mock_frameworks/mocha.rb +0 -0
- data/{plugins → lib/adapters}/mock_frameworks/rr.rb +0 -0
- data/{plugins → lib/adapters}/mock_frameworks/rspec.rb +1 -1
- data/lib/autotest/rspec.rb +3 -2
- data/lib/spec/dsl/main.rb +8 -4
- data/lib/spec/example/configuration.rb +1 -1
- data/lib/spec/example/example_group_factory.rb +6 -2
- data/lib/spec/example/example_group_methods.rb +47 -54
- data/lib/spec/example/shared_example_group.rb +2 -2
- data/lib/spec/example.rb +163 -14
- data/lib/spec/interop/test/unit/testresult.rb +1 -1
- data/lib/spec/interop/test/unit/testsuite_adapter.rb +1 -1
- data/lib/spec/matchers/match_array.rb +75 -0
- data/lib/spec/matchers/operator_matcher.rb +34 -7
- data/lib/spec/matchers.rb +2 -1
- data/lib/spec/mocks/argument_constraints.rb +43 -5
- data/lib/spec/runner/example_group_runner.rb +2 -2
- data/lib/spec/runner/option_parser.rb +12 -6
- data/lib/spec/runner/options.rb +9 -9
- data/lib/spec/runner/spec_parser.rb +3 -2
- data/lib/spec/runner.rb +54 -188
- data/lib/spec/version.rb +1 -1
- data/lib/spec.rb +0 -29
- data/{rake_tasks → resources/rake}/examples.rake +0 -0
- data/{rake_tasks → resources/rake}/examples_with_rcov.rake +0 -0
- data/{rake_tasks → resources/rake}/failing_examples_with_html.rake +0 -0
- data/{rake_tasks → resources/rake}/verify_rcov.rake +0 -0
- data/{stories/resources → resources}/spec/before_blocks_example.rb +1 -1
- data/{stories/resources → resources}/spec/example_group_with_should_methods.rb +1 -1
- data/{stories/resources → resources}/spec/simple_spec.rb +1 -1
- data/resources/spec/spec_with_flexmock.rb +19 -0
- data/{stories/resources → resources}/test/spec_and_test_together.rb +1 -1
- data/{stories/resources → resources}/test/spec_including_test_but_not_unit.rb +1 -1
- data/{stories/resources → resources}/test/test_case_with_should_methods.rb +2 -2
- data/rspec.gemspec +5 -4
- data/spec/autotest/rspec_spec.rb +2 -1
- data/spec/spec/dsl/main_spec.rb +8 -5
- data/spec/spec/example/configuration_spec.rb +9 -9
- data/spec/spec/example/example_group_factory_spec.rb +22 -3
- data/spec/spec/example/example_group_methods_spec.rb +19 -15
- data/spec/spec/example/example_group_spec.rb +41 -41
- data/spec/spec/example/example_methods_spec.rb +5 -5
- data/spec/spec/example/helper_method_spec.rb +24 -0
- data/spec/spec/example/pending_module_spec.rb +2 -8
- data/spec/spec/example/shared_example_group_spec.rb +5 -5
- data/spec/spec/matchers/description_generation_spec.rb +5 -0
- data/spec/spec/matchers/handler_spec.rb +7 -7
- data/spec/spec/matchers/match_array_spec.rb +83 -0
- data/spec/spec/matchers/raise_error_spec.rb +18 -0
- data/spec/spec/mocks/hash_including_matcher_spec.rb +39 -2
- data/spec/spec/mocks/hash_not_including_matcher_spec.rb +67 -0
- data/spec/spec/mocks/mock_spec.rb +5 -6
- data/spec/spec/mocks/nil_expectation_warning_spec.rb +1 -1
- data/spec/spec/runner/formatter/base_text_formatter_spec.rb +22 -0
- data/spec/spec/runner/option_parser_spec.rb +4 -17
- data/spec/spec/runner/options_spec.rb +19 -5
- data/spec/spec/runner/resources/custom_example_group_runner.rb +14 -0
- data/spec/spec/runner/spec_parser_spec.rb +10 -0
- data/spec/spec/spec_spec.rb +21 -0
- metadata +39 -49
- data/lib/spec/adapters/ruby_engine/mri.rb +0 -8
- data/lib/spec/adapters/ruby_engine/rubinius.rb +0 -8
- data/lib/spec/adapters/ruby_engine.rb +0 -26
- data/lib/spec/adapters.rb +0 -1
- data/lib/spec/extensions/class.rb +0 -24
- data/lib/spec/extensions.rb +0 -1
- data/spec/spec/adapters/ruby_engine_spec.rb +0 -16
- data/stories/all.rb +0 -5
- data/stories/configuration/stories.rb +0 -7
- data/stories/example_groups/stories.rb +0 -7
- data/stories/helper.rb +0 -6
- data/stories/interop/stories.rb +0 -7
- data/stories/mock_framework_integration/stories.rb +0 -7
- data/stories/pending_stories/README +0 -3
- data/stories/resources/spec/spec_with_flexmock.rb +0 -18
- data/stories/resources/steps/running_rspec.rb +0 -50
- data/stories/resources/stories/failing_story.rb +0 -15
- data/stories/stories/multiline_steps.story +0 -23
- data/stories/stories/steps/multiline_steps.rb +0 -13
- data/stories/stories/stories.rb +0 -6
data/spec/spec/dsl/main_spec.rb
CHANGED
@@ -12,7 +12,7 @@ module Spec
|
|
12
12
|
it "should delegate to Spec::Example::ExampleGroupFactory.create_example_group" do
|
13
13
|
block = lambda {}
|
14
14
|
Spec::Example::ExampleGroupFactory.should_receive(:create_example_group).with(
|
15
|
-
"The ExampleGroup", &block
|
15
|
+
"The ExampleGroup", hash_including(:spec_path), &block
|
16
16
|
)
|
17
17
|
@main.__send__ method, "The ExampleGroup", &block
|
18
18
|
end
|
@@ -23,8 +23,8 @@ module Spec
|
|
23
23
|
describe "##{method}" do
|
24
24
|
it "should create a shared ExampleGroup" do
|
25
25
|
block = lambda {}
|
26
|
-
Spec::Example::
|
27
|
-
"shared group", &block
|
26
|
+
Spec::Example::ExampleGroupFactory.should_receive(:create_shared_example_group).with(
|
27
|
+
"shared group", hash_including(:spec_path), &block
|
28
28
|
)
|
29
29
|
@main.__send__ method, "shared group", &block
|
30
30
|
end
|
@@ -43,8 +43,11 @@ module Spec
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "registers a shared ExampleGroup" do
|
46
|
-
|
47
|
-
|
46
|
+
block = lambda {}
|
47
|
+
Spec::Example::ExampleGroupFactory.should_receive(:create_shared_example_group).with(
|
48
|
+
group_name, hash_including(:spec_path), &block
|
49
|
+
)
|
50
|
+
@main.share_as group_name, &block
|
48
51
|
end
|
49
52
|
|
50
53
|
it "creates a constant that points to a Module" do
|
@@ -12,27 +12,27 @@ module Spec
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should default mock framework to rspec" do
|
15
|
-
@config.mock_framework.should =~ /\/
|
15
|
+
@config.mock_framework.should =~ /\/adapters\/mock_frameworks\/rspec$/
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should set rspec mocking explicitly" do
|
19
19
|
@config.mock_with(:rspec)
|
20
|
-
@config.mock_framework.should =~ /\/
|
20
|
+
@config.mock_framework.should =~ /\/adapters\/mock_frameworks\/rspec$/
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should set mocha" do
|
24
24
|
@config.mock_with(:mocha)
|
25
|
-
@config.mock_framework.should =~ /\/
|
25
|
+
@config.mock_framework.should =~ /\/adapters\/mock_frameworks\/mocha$/
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should set flexmock" do
|
29
29
|
@config.mock_with(:flexmock)
|
30
|
-
@config.mock_framework.should =~ /\/
|
30
|
+
@config.mock_framework.should =~ /\/adapters\/mock_frameworks\/flexmock$/
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should set rr" do
|
34
34
|
@config.mock_with(:rr)
|
35
|
-
@config.mock_framework.should =~ /\/
|
35
|
+
@config.mock_framework.should =~ /\/adapters\/mock_frameworks\/rr$/
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should set an arbitrary adapter module" do
|
@@ -150,7 +150,7 @@ module Spec
|
|
150
150
|
@example_group.it "calls prepend_before" do
|
151
151
|
end
|
152
152
|
|
153
|
-
@example_group.run
|
153
|
+
@example_group.run(Spec::Runner.options)
|
154
154
|
order.should == [
|
155
155
|
:prepend__before_all,
|
156
156
|
:special_prepend__before_all,
|
@@ -193,7 +193,7 @@ module Spec
|
|
193
193
|
@example_group.it "calls append_before" do
|
194
194
|
end
|
195
195
|
|
196
|
-
@example_group.run
|
196
|
+
@example_group.run(Spec::Runner.options)
|
197
197
|
order.should == [
|
198
198
|
:append_before_all,
|
199
199
|
:special_append_before_all,
|
@@ -236,7 +236,7 @@ module Spec
|
|
236
236
|
@example_group.it "calls prepend_after" do
|
237
237
|
end
|
238
238
|
|
239
|
-
@example_group.run
|
239
|
+
@example_group.run(Spec::Runner.options)
|
240
240
|
order.should == [
|
241
241
|
:special_child_prepend__after_each,
|
242
242
|
:special_prepend__after_each,
|
@@ -279,7 +279,7 @@ module Spec
|
|
279
279
|
@example_group.it "calls append_after" do
|
280
280
|
end
|
281
281
|
|
282
|
-
@example_group.run
|
282
|
+
@example_group.run(Spec::Runner.options)
|
283
283
|
order.should == [
|
284
284
|
:special_child_append__after_each,
|
285
285
|
:special_append__after_each,
|
@@ -73,7 +73,7 @@ module Spec
|
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should not run unregistered ExampleGroups" do
|
76
|
-
example_group = Spec::Example::ExampleGroupFactory.create_example_group "The ExampleGroup" do
|
76
|
+
example_group = Spec::Example::ExampleGroupFactory.create_example_group "The ExampleGroup" do Spec::Runner.options.remove_example_group self; end
|
77
77
|
Spec::Runner.options.example_groups.should_not include(example_group)
|
78
78
|
end
|
79
79
|
|
@@ -112,6 +112,12 @@ module Spec
|
|
112
112
|
) {}
|
113
113
|
custom_example_group.superclass.should == parent_example_group
|
114
114
|
end
|
115
|
+
|
116
|
+
it "sets the spec_path from the caller" do
|
117
|
+
options = {}
|
118
|
+
shared_example_group = Spec::Example::ExampleGroupFactory.create_example_group("foo", options) {}
|
119
|
+
options[:spec_path].should =~ /#{__FILE__}:#{__LINE__ - 1}/
|
120
|
+
end
|
115
121
|
|
116
122
|
describe "with :shared => true" do
|
117
123
|
def shared_example_group
|
@@ -142,17 +148,30 @@ module Spec
|
|
142
148
|
|
143
149
|
it "should enable unregistering of ExampleGroups" do
|
144
150
|
example_group = Spec::Example::ExampleGroupFactory.create_example_group("The ExampleGroup") do
|
145
|
-
|
151
|
+
Spec::Runner.options.remove_example_group self
|
146
152
|
end
|
147
153
|
Spec::Runner.options.example_groups.should_not include(example_group)
|
148
154
|
end
|
149
155
|
|
150
|
-
|
151
156
|
after(:each) do
|
152
157
|
Spec::Example::ExampleGroupFactory.reset
|
153
158
|
end
|
154
159
|
end
|
155
160
|
|
161
|
+
describe "#create_shared_example_group" do
|
162
|
+
it "registers a new shared example group" do
|
163
|
+
shared_example_group = Spec::Example::ExampleGroupFactory.create_shared_example_group("something shared") {}
|
164
|
+
shared_example_group.should be_an_instance_of(Spec::Example::SharedExampleGroup)
|
165
|
+
SharedExampleGroup.should include(shared_example_group)
|
166
|
+
end
|
167
|
+
|
168
|
+
it "sets the spec_path from the caller" do
|
169
|
+
options = {}
|
170
|
+
shared_example_group = Spec::Example::ExampleGroupFactory.create_shared_example_group("foo", options) {}
|
171
|
+
options[:spec_path].should =~ /#{__FILE__}:#{__LINE__ - 1}/
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
156
175
|
describe "#registered_or_ancestor_of_registered?" do
|
157
176
|
before(:each) do
|
158
177
|
@unregistered_parent = Class.new(ExampleGroup)
|
@@ -42,6 +42,10 @@ module Spec
|
|
42
42
|
it "should not inherit examples" do
|
43
43
|
@child_example_group.should have(1).examples
|
44
44
|
end
|
45
|
+
|
46
|
+
it "records the spec path" do
|
47
|
+
@child_example_group.spec_path.should =~ /#{__FILE__}:#{__LINE__ - 15}/
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
47
51
|
describe "when creating a SharedExampleGroup" do
|
@@ -120,7 +124,7 @@ module Spec
|
|
120
124
|
end
|
121
125
|
end
|
122
126
|
example_group.examples.length.should == 1
|
123
|
-
example_group.run.should be_true
|
127
|
+
example_group.run(options).should be_true
|
124
128
|
end
|
125
129
|
|
126
130
|
it "should include methods that begin with should and has an arity of 0 in suite" do
|
@@ -145,7 +149,7 @@ module Spec
|
|
145
149
|
end
|
146
150
|
end
|
147
151
|
example_group.should have(4).examples
|
148
|
-
descriptions = example_group.examples.collect {|example| example.description}
|
152
|
+
descriptions = example_group.examples.collect {|example| example.description.to_s}
|
149
153
|
descriptions.should include(
|
150
154
|
"shouldCamelCase",
|
151
155
|
"should_any_args",
|
@@ -185,7 +189,7 @@ module Spec
|
|
185
189
|
end
|
186
190
|
end
|
187
191
|
example_group.should have(1).examples
|
188
|
-
example_group.run.should be_true
|
192
|
+
example_group.run(options).should be_true
|
189
193
|
end
|
190
194
|
|
191
195
|
it "should run should_methods" do
|
@@ -195,7 +199,7 @@ module Spec
|
|
195
199
|
end
|
196
200
|
end
|
197
201
|
example_group.should have(1).examples
|
198
|
-
example_group.run.should be_false
|
202
|
+
example_group.run(options).should be_false
|
199
203
|
end
|
200
204
|
end
|
201
205
|
|
@@ -412,12 +416,12 @@ module Spec
|
|
412
416
|
after(:each, &proc)
|
413
417
|
end
|
414
418
|
|
415
|
-
example_group.run
|
419
|
+
example_group.run(options)
|
416
420
|
after_all_ran.should be_true
|
417
421
|
|
418
422
|
after_all_ran = false
|
419
423
|
example_group.remove_after(:each, &proc)
|
420
|
-
example_group.run
|
424
|
+
example_group.run(options)
|
421
425
|
after_all_ran.should be_false
|
422
426
|
end
|
423
427
|
end
|
@@ -465,7 +469,7 @@ module Spec
|
|
465
469
|
FOO.should == 1
|
466
470
|
end
|
467
471
|
end
|
468
|
-
success = example_group.run
|
472
|
+
success = example_group.run(options)
|
469
473
|
success.should be_true
|
470
474
|
Object.const_defined?(:FOO).should == false
|
471
475
|
end
|
@@ -473,20 +477,20 @@ module Spec
|
|
473
477
|
|
474
478
|
describe '#register' do
|
475
479
|
after(:each) do
|
476
|
-
example_group
|
480
|
+
Spec::Runner.options.remove_example_group example_group
|
477
481
|
end
|
478
482
|
it "should add ExampleGroup to set of ExampleGroups to be run" do
|
479
|
-
example_group
|
483
|
+
Spec::Runner.options.add_example_group example_group
|
480
484
|
options.example_groups.should include(example_group)
|
481
485
|
end
|
482
486
|
end
|
483
487
|
|
484
488
|
describe '#unregister' do
|
485
489
|
before(:each) do
|
486
|
-
example_group
|
490
|
+
Spec::Runner.options.add_example_group example_group
|
487
491
|
end
|
488
492
|
it "should remove ExampleGroup from set of ExampleGroups to be run" do
|
489
|
-
example_group
|
493
|
+
Spec::Runner.options.remove_example_group example_group
|
490
494
|
options.example_groups.should_not include(example_group)
|
491
495
|
end
|
492
496
|
end
|
@@ -498,7 +502,7 @@ module Spec
|
|
498
502
|
example("anything") {}
|
499
503
|
end
|
500
504
|
reporter.should_receive(:add_example_group)
|
501
|
-
example_group.run
|
505
|
+
example_group.run(options)
|
502
506
|
end
|
503
507
|
end
|
504
508
|
|
@@ -506,7 +510,7 @@ module Spec
|
|
506
510
|
it "should NOT call add_example_group" do
|
507
511
|
example_group = Class.new(ExampleGroup) do end
|
508
512
|
reporter.should_not_receive(:add_example_group)
|
509
|
-
example_group.run
|
513
|
+
example_group.run(options)
|
510
514
|
end
|
511
515
|
end
|
512
516
|
end
|
@@ -527,12 +531,12 @@ module Spec
|
|
527
531
|
matcher.should_receive(:matches?).with(["something"]).any_number_of_times
|
528
532
|
|
529
533
|
matcher_class = Class.new
|
530
|
-
matcher_class.should_receive(:new).with("TestMatcher", "should do something").
|
534
|
+
matcher_class.should_receive(:new).with("TestMatcher", "should do something").and_return(matcher)
|
531
535
|
|
532
536
|
begin
|
533
537
|
ExampleGroupMethods.matcher_class = matcher_class
|
534
538
|
|
535
|
-
example_group.run
|
539
|
+
example_group.run(options)
|
536
540
|
ensure
|
537
541
|
ExampleGroupMethods.matcher_class = ExampleMatcher
|
538
542
|
end
|
@@ -60,7 +60,7 @@ module Spec
|
|
60
60
|
|
61
61
|
describe ExampleGroup, "#run with failure in example", :shared => true do
|
62
62
|
it "should add an example failure to the TestResult" do
|
63
|
-
example_group.run.should be_false
|
63
|
+
example_group.run(options).should be_false
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -96,7 +96,7 @@ module Spec
|
|
96
96
|
|
97
97
|
reporter = mock("Reporter")
|
98
98
|
reporter.should_not_receive(:add_example_group)
|
99
|
-
example_group.run
|
99
|
+
example_group.run(options)
|
100
100
|
end
|
101
101
|
|
102
102
|
describe "when before_each fails" do
|
@@ -114,12 +114,12 @@ module Spec
|
|
114
114
|
end
|
115
115
|
|
116
116
|
it "should not run example block" do
|
117
|
-
example_group.run
|
117
|
+
example_group.run(options)
|
118
118
|
$example_ran.should be_false
|
119
119
|
end
|
120
120
|
|
121
121
|
it "should run after_each" do
|
122
|
-
example_group.run
|
122
|
+
example_group.run(options)
|
123
123
|
$after_each_ran.should be_true
|
124
124
|
end
|
125
125
|
|
@@ -127,7 +127,7 @@ module Spec
|
|
127
127
|
reporter.should_receive(:example_finished) do |example_group, error|
|
128
128
|
error.message.should eql("in before_each")
|
129
129
|
end
|
130
|
-
example_group.run
|
130
|
+
example_group.run(options)
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
@@ -142,7 +142,7 @@ module Spec
|
|
142
142
|
ExampleGroup.before(:all) { before_all_ran = true }
|
143
143
|
ExampleGroup.after(:all) { after_all_ran = true }
|
144
144
|
example_group.it("should") {}
|
145
|
-
example_group.run
|
145
|
+
example_group.run(options)
|
146
146
|
before_all_ran.should be_false
|
147
147
|
after_all_ran.should be_false
|
148
148
|
end
|
@@ -150,7 +150,7 @@ module Spec
|
|
150
150
|
it "should not run example" do
|
151
151
|
example_ran = false
|
152
152
|
example_group.it("should") {example_ran = true}
|
153
|
-
example_group.run
|
153
|
+
example_group.run(options)
|
154
154
|
example_ran.should be_false
|
155
155
|
end
|
156
156
|
end
|
@@ -174,11 +174,11 @@ module Spec
|
|
174
174
|
examples_that_were_run << 'should also be run'
|
175
175
|
end
|
176
176
|
end
|
177
|
-
options.
|
177
|
+
options.parse_example "the ExampleGroup"
|
178
178
|
end
|
179
179
|
|
180
180
|
it "should not run the Examples in the ExampleGroup" do
|
181
|
-
example_group.run
|
181
|
+
example_group.run(options)
|
182
182
|
examples_that_were_run.should == ['should be run', 'should also be run']
|
183
183
|
end
|
184
184
|
end
|
@@ -192,11 +192,11 @@ module Spec
|
|
192
192
|
examples_that_were_run << 'should be run'
|
193
193
|
end
|
194
194
|
end
|
195
|
-
options.
|
195
|
+
options.parse_example "should be run"
|
196
196
|
end
|
197
197
|
|
198
198
|
it "should not run the example" do
|
199
|
-
example_group.run
|
199
|
+
example_group.run(options)
|
200
200
|
examples_that_were_run.should == ['should be run']
|
201
201
|
end
|
202
202
|
end
|
@@ -210,11 +210,11 @@ module Spec
|
|
210
210
|
examples_that_were_run << 'should be something else'
|
211
211
|
end
|
212
212
|
end
|
213
|
-
options.
|
213
|
+
options.parse_example "does not match anything"
|
214
214
|
end
|
215
215
|
|
216
216
|
it "should not run the example" do
|
217
|
-
example_group.run
|
217
|
+
example_group.run(options)
|
218
218
|
examples_that_were_run.should == []
|
219
219
|
end
|
220
220
|
end
|
@@ -231,16 +231,16 @@ module Spec
|
|
231
231
|
examples_that_were_run << 'should not be run'
|
232
232
|
end
|
233
233
|
end
|
234
|
-
options.
|
234
|
+
options.parse_example "should be run"
|
235
235
|
end
|
236
236
|
|
237
237
|
it "should run only the example, when there is only one" do
|
238
|
-
example_group.run
|
238
|
+
example_group.run(options)
|
239
239
|
examples_that_were_run.should == ["should be run"]
|
240
240
|
end
|
241
241
|
|
242
242
|
it "should run only the one example" do
|
243
|
-
example_group.run
|
243
|
+
example_group.run(options)
|
244
244
|
examples_that_were_run.should == ["should be run"] end
|
245
245
|
end
|
246
246
|
end
|
@@ -258,14 +258,14 @@ module Spec
|
|
258
258
|
end
|
259
259
|
|
260
260
|
it "should send reporter add_example_group" do
|
261
|
-
example_group.run
|
261
|
+
example_group.run(options)
|
262
262
|
reporter.example_groups.should == [example_group]
|
263
263
|
end
|
264
264
|
|
265
265
|
it "should run example on run" do
|
266
266
|
example_ran = false
|
267
267
|
example_group.it("should") {example_ran = true}
|
268
|
-
example_group.run
|
268
|
+
example_group.run(options)
|
269
269
|
example_ran.should be_true
|
270
270
|
end
|
271
271
|
|
@@ -274,7 +274,7 @@ module Spec
|
|
274
274
|
example_group.before(:all) {before_all_run_count_run_count += 1}
|
275
275
|
example_group.it("test") {true}
|
276
276
|
example_group.it("test2") {true}
|
277
|
-
example_group.run
|
277
|
+
example_group.run(options)
|
278
278
|
before_all_run_count_run_count.should == 1
|
279
279
|
end
|
280
280
|
|
@@ -283,7 +283,7 @@ module Spec
|
|
283
283
|
example_group.after(:all) {after_all_run_count += 1}
|
284
284
|
example_group.it("test") {true}
|
285
285
|
example_group.it("test2") {true}
|
286
|
-
example_group.run
|
286
|
+
example_group.run(options)
|
287
287
|
after_all_run_count.should == 1
|
288
288
|
@reporter.rspec_verify
|
289
289
|
end
|
@@ -294,7 +294,7 @@ module Spec
|
|
294
294
|
example_group.before(:all) { @instance_var = context_instance_value_in }
|
295
295
|
example_group.after(:all) { context_instance_value_out = @instance_var }
|
296
296
|
example_group.it("test") {true}
|
297
|
-
example_group.run
|
297
|
+
example_group.run(options)
|
298
298
|
context_instance_value_in.should == context_instance_value_out
|
299
299
|
end
|
300
300
|
|
@@ -303,7 +303,7 @@ module Spec
|
|
303
303
|
context_instance_value_out = ""
|
304
304
|
example_group.before(:all) { @instance_var = context_instance_value_in }
|
305
305
|
example_group.it("test") {context_instance_value_out = @instance_var}
|
306
|
-
example_group.run
|
306
|
+
example_group.run(options)
|
307
307
|
context_instance_value_in.should == context_instance_value_out
|
308
308
|
end
|
309
309
|
|
@@ -321,7 +321,7 @@ module Spec
|
|
321
321
|
describe("I'm not special", :type => :not_special)
|
322
322
|
it "does nothing"
|
323
323
|
end
|
324
|
-
example_group.run
|
324
|
+
example_group.run(options)
|
325
325
|
fiddle.should == [
|
326
326
|
'Example.prepend_before(:all)',
|
327
327
|
'Example.before(:all)',
|
@@ -341,7 +341,7 @@ module Spec
|
|
341
341
|
|
342
342
|
example_group = Class.new(@special_example_group).describe("I'm a special example_group") {}
|
343
343
|
example_group.it("test") {true}
|
344
|
-
example_group.run
|
344
|
+
example_group.run(options)
|
345
345
|
fiddle.should == [
|
346
346
|
'Example.prepend_before(:all)',
|
347
347
|
'Example.before(:all)',
|
@@ -361,7 +361,7 @@ module Spec
|
|
361
361
|
example_group.before(:all) { fiddle << "before(:all)" }
|
362
362
|
example_group.prepend_before(:each) { fiddle << "prepend_before(:each)" }
|
363
363
|
example_group.before(:each) { fiddle << "before(:each)" }
|
364
|
-
example_group.run
|
364
|
+
example_group.run(options)
|
365
365
|
fiddle.should == [
|
366
366
|
'Example.prepend_before(:all)',
|
367
367
|
'Example.before(:all)',
|
@@ -380,7 +380,7 @@ module Spec
|
|
380
380
|
example_group.append_after(:all) { fiddle << "append_after(:all)" }
|
381
381
|
ExampleGroup.after(:all) { fiddle << "Example.after(:all)" }
|
382
382
|
ExampleGroup.append_after(:all) { fiddle << "Example.append_after(:all)" }
|
383
|
-
example_group.run
|
383
|
+
example_group.run(options)
|
384
384
|
fiddle.should == [
|
385
385
|
'after(:each)',
|
386
386
|
'append_after(:each)',
|
@@ -412,7 +412,7 @@ module Spec
|
|
412
412
|
mod1_method
|
413
413
|
mod2_method
|
414
414
|
end
|
415
|
-
example_group.run
|
415
|
+
example_group.run(options)
|
416
416
|
mod1_method_called.should be_true
|
417
417
|
mod2_method_called.should be_true
|
418
418
|
end
|
@@ -427,7 +427,7 @@ module Spec
|
|
427
427
|
example_group = Class.new(@special_example_group).describe("I'm special", :type => :special) do
|
428
428
|
it "does nothing"
|
429
429
|
end
|
430
|
-
example_group.run
|
430
|
+
example_group.run(options)
|
431
431
|
|
432
432
|
example_group.included_modules.should include(mod1)
|
433
433
|
example_group.included_modules.should include(mod2)
|
@@ -443,7 +443,7 @@ module Spec
|
|
443
443
|
$included_predicate_matcher_found = respond_to?(:do_something)
|
444
444
|
end
|
445
445
|
end
|
446
|
-
example_group.run
|
446
|
+
example_group.run(options)
|
447
447
|
$included_predicate_matcher_found.should be(true)
|
448
448
|
end
|
449
449
|
|
@@ -467,7 +467,7 @@ module Spec
|
|
467
467
|
describe('example')
|
468
468
|
it "does nothing"
|
469
469
|
end
|
470
|
-
example_group.run
|
470
|
+
example_group.run(options)
|
471
471
|
|
472
472
|
$included_module.should_not be_nil
|
473
473
|
$torn_down.should == true
|
@@ -486,7 +486,7 @@ module Spec
|
|
486
486
|
|
487
487
|
it "should send example_pending to formatter" do
|
488
488
|
@formatter.should_receive(:example_pending).with("example", "should be pending", "Example fails")
|
489
|
-
example_group.run
|
489
|
+
example_group.run(options)
|
490
490
|
end
|
491
491
|
end
|
492
492
|
|
@@ -501,7 +501,7 @@ module Spec
|
|
501
501
|
|
502
502
|
it "should send example_pending to formatter" do
|
503
503
|
@formatter.should_receive(:example_pending).with("example", "should be pending", "Example passes")
|
504
|
-
example_group.run
|
504
|
+
example_group.run(options)
|
505
505
|
end
|
506
506
|
end
|
507
507
|
|
@@ -515,21 +515,21 @@ module Spec
|
|
515
515
|
it "should not run any example" do
|
516
516
|
spec_ran = false
|
517
517
|
example_group.it("test") {spec_ran = true}
|
518
|
-
example_group.run
|
518
|
+
example_group.run(options)
|
519
519
|
spec_ran.should be_false
|
520
520
|
end
|
521
521
|
|
522
522
|
it "should run ExampleGroup after(:all)" do
|
523
523
|
after_all_ran = false
|
524
524
|
ExampleGroup.after(:all) { after_all_ran = true }
|
525
|
-
example_group.run
|
525
|
+
example_group.run(options)
|
526
526
|
after_all_ran.should be_true
|
527
527
|
end
|
528
528
|
|
529
529
|
it "should run example_group after(:all)" do
|
530
530
|
after_all_ran = false
|
531
531
|
example_group.after(:all) { after_all_ran = true }
|
532
|
-
example_group.run
|
532
|
+
example_group.run(options)
|
533
533
|
after_all_ran.should be_true
|
534
534
|
end
|
535
535
|
|
@@ -540,7 +540,7 @@ module Spec
|
|
540
540
|
end
|
541
541
|
|
542
542
|
example_group.it("test") {true}
|
543
|
-
example_group.run
|
543
|
+
example_group.run(options)
|
544
544
|
end
|
545
545
|
end
|
546
546
|
|
@@ -554,7 +554,7 @@ module Spec
|
|
554
554
|
it "should run after(:all)" do
|
555
555
|
after_all_ran = false
|
556
556
|
ExampleGroup.after(:all) { after_all_ran = true }
|
557
|
-
example_group.run
|
557
|
+
example_group.run(options)
|
558
558
|
after_all_ran.should be_true
|
559
559
|
end
|
560
560
|
end
|
@@ -569,7 +569,7 @@ module Spec
|
|
569
569
|
it "should run after(:all)" do
|
570
570
|
after_all_ran = false
|
571
571
|
ExampleGroup.after(:all) { after_all_ran = true }
|
572
|
-
example_group.run
|
572
|
+
example_group.run(options)
|
573
573
|
after_all_ran.should be_true
|
574
574
|
end
|
575
575
|
end
|
@@ -598,7 +598,7 @@ module Spec
|
|
598
598
|
example.should equal(example)
|
599
599
|
error.message.should eql("first")
|
600
600
|
end
|
601
|
-
example_group.run
|
601
|
+
example_group.run(options)
|
602
602
|
example_group.first_after_ran.should be_true
|
603
603
|
example_group.second_after_ran.should be_true
|
604
604
|
end
|
@@ -627,7 +627,7 @@ module Spec
|
|
627
627
|
reporter.should_receive(:example_finished) do |name, error|
|
628
628
|
error.message.should eql("first")
|
629
629
|
end
|
630
|
-
example_group.run
|
630
|
+
example_group.run(options)
|
631
631
|
example_group.first_before_ran.should be_true
|
632
632
|
example_group.second_before_ran.should be_false
|
633
633
|
end
|
@@ -641,7 +641,7 @@ module Spec
|
|
641
641
|
end
|
642
642
|
|
643
643
|
it "should return false" do
|
644
|
-
example_group.run.should be_false
|
644
|
+
example_group.run(options).should be_false
|
645
645
|
end
|
646
646
|
end
|
647
647
|
end
|
@@ -212,7 +212,7 @@ module Spec
|
|
212
212
|
example { should == @foo}
|
213
213
|
it { should == 'foo'}
|
214
214
|
end
|
215
|
-
example_group.run.should be_true
|
215
|
+
example_group.run(options).should be_true
|
216
216
|
end
|
217
217
|
end
|
218
218
|
end
|
@@ -234,7 +234,7 @@ module Spec
|
|
234
234
|
it { should eql('expected') }
|
235
235
|
end
|
236
236
|
@example = example_group.examples.first
|
237
|
-
@success = example_group.run
|
237
|
+
@success = example_group.run(options)
|
238
238
|
end
|
239
239
|
|
240
240
|
it "should create an example using the description from the matcher" do
|
@@ -253,7 +253,7 @@ module Spec
|
|
253
253
|
it { should eql('this is the subject') }
|
254
254
|
end
|
255
255
|
example = example_group.examples.first
|
256
|
-
example_group.run
|
256
|
+
example_group.run(options)
|
257
257
|
example.description.should =~ /should eql "this is the subject"/
|
258
258
|
end
|
259
259
|
end
|
@@ -264,7 +264,7 @@ module Spec
|
|
264
264
|
it { should == Thing.new }
|
265
265
|
end
|
266
266
|
example = example_group.examples.first
|
267
|
-
success = example_group.run
|
267
|
+
success = example_group.run(options)
|
268
268
|
example.description.should =~ /should == #<Spec::Example::Thing/
|
269
269
|
success.should be_true
|
270
270
|
end
|
@@ -290,7 +290,7 @@ module Spec
|
|
290
290
|
end
|
291
291
|
@example = @example_group.examples.first
|
292
292
|
|
293
|
-
@success = example_group.run
|
293
|
+
@success = example_group.run(options)
|
294
294
|
end
|
295
295
|
|
296
296
|
it "should create an example using the description from the matcher" do
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
# This was added to prove that http://rspec.lighthouseapp.com/projects/5645/tickets/211
|
4
|
+
# was fixed in ruby 1.9.1
|
5
|
+
|
6
|
+
module HelperMethodExample
|
7
|
+
describe "a helper method" do
|
8
|
+
def helper_method
|
9
|
+
"received call"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "is available to examples in the same group" do
|
13
|
+
helper_method.should == "received call"
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "from a nested group" do
|
17
|
+
it "is available to examples in a nested group" do
|
18
|
+
helper_method.should == "received call"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|