rspec-core 2.0.0.a1
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/.document +5 -0
- data/.gitignore +7 -0
- data/.treasure_map.rb +23 -0
- data/License.txt +22 -0
- data/README.markdown +9 -0
- data/Rakefile +76 -0
- data/TODO.markdown +16 -0
- data/VERSION +1 -0
- data/VERSION.yml +5 -0
- data/bin/rspec +12 -0
- data/cucumber.yml +2 -0
- data/example_specs/failing/README.txt +7 -0
- data/example_specs/failing/diffing_spec.rb +36 -0
- data/example_specs/failing/failing_implicit_docstrings_example.rb +19 -0
- data/example_specs/failing/failure_in_after.rb +10 -0
- data/example_specs/failing/failure_in_before.rb +10 -0
- data/example_specs/failing/mocking_example.rb +40 -0
- data/example_specs/failing/mocking_with_flexmock.rb +26 -0
- data/example_specs/failing/mocking_with_mocha.rb +25 -0
- data/example_specs/failing/mocking_with_rr.rb +27 -0
- data/example_specs/failing/partial_mock_example.rb +20 -0
- data/example_specs/failing/pending_example.rb +9 -0
- data/example_specs/failing/predicate_example.rb +34 -0
- data/example_specs/failing/raising_example.rb +47 -0
- data/example_specs/failing/spec_helper.rb +3 -0
- data/example_specs/failing/syntax_error_example.rb +7 -0
- data/example_specs/failing/team_spec.rb +44 -0
- data/example_specs/failing/timeout_behaviour.rb +7 -0
- data/example_specs/passing/custom_formatter.rb +12 -0
- data/example_specs/passing/custom_matchers.rb +54 -0
- data/example_specs/passing/dynamic_spec.rb +9 -0
- data/example_specs/passing/file_accessor.rb +19 -0
- data/example_specs/passing/file_accessor_spec.rb +38 -0
- data/example_specs/passing/filtered_formatter.rb +18 -0
- data/example_specs/passing/filtered_formatter_example.rb +31 -0
- data/example_specs/passing/greeter_spec.rb +31 -0
- data/example_specs/passing/helper_method_example.rb +14 -0
- data/example_specs/passing/implicit_docstrings_example.rb +18 -0
- data/example_specs/passing/io_processor.rb +8 -0
- data/example_specs/passing/io_processor_spec.rb +21 -0
- data/example_specs/passing/mocking_example.rb +27 -0
- data/example_specs/passing/multi_threaded_example_group_runner.rb +26 -0
- data/example_specs/passing/nested_classes_example.rb +36 -0
- data/example_specs/passing/options_example.rb +31 -0
- data/example_specs/passing/options_formatter.rb +20 -0
- data/example_specs/passing/partial_mock_example.rb +29 -0
- data/example_specs/passing/pending_example.rb +20 -0
- data/example_specs/passing/predicate_example.rb +27 -0
- data/example_specs/passing/shared_example_group_example.rb +81 -0
- data/example_specs/passing/shared_stack_examples.rb +36 -0
- data/example_specs/passing/simple_matcher_example.rb +31 -0
- data/example_specs/passing/spec_helper.rb +14 -0
- data/example_specs/passing/stack.rb +36 -0
- data/example_specs/passing/stack_spec.rb +64 -0
- data/example_specs/passing/stack_spec_with_nested_example_groups.rb +67 -0
- data/example_specs/passing/stubbing_example.rb +69 -0
- data/example_specs/passing/yielding_example.rb +33 -0
- data/example_specs/ruby1.9.compatibility/access_to_constants_spec.rb +85 -0
- data/features-pending/command_line/line_number_option.feature +56 -0
- data/features-pending/command_line/line_number_option_with_example_with_no_name.feature +22 -0
- data/features-pending/example_groups/example_group_with_should_methods.feature +29 -0
- data/features-pending/example_groups/implicit_docstrings.feature +59 -0
- data/features-pending/example_groups/nested_groups.feature +32 -0
- data/features-pending/expectations/expect_change.feature +65 -0
- data/features-pending/expectations/expect_error.feature +44 -0
- data/features-pending/extensions/custom_example_group.feature +19 -0
- data/features-pending/formatters/custom_formatter.feature +30 -0
- data/features-pending/heckle/heckle.feature +56 -0
- data/features-pending/interop/examples_and_tests_together.feature +80 -0
- data/features-pending/interop/rspec_output.feature +25 -0
- data/features-pending/interop/test_but_not_test_unit.feature +26 -0
- data/features-pending/interop/test_case_with_should_methods.feature +46 -0
- data/features-pending/matchers/define_diffable_matcher.feature +26 -0
- data/features-pending/matchers/define_matcher.feature +179 -0
- data/features-pending/matchers/define_matcher_with_fluent_interface.feature +27 -0
- data/features-pending/mocks/mix_stubs_and_mocks.feature +22 -0
- data/features-pending/mocks/stub_implementation.feature +26 -0
- data/features-pending/pending/pending_examples.feature +81 -0
- data/features-pending/runner/specify_line_number.feature +32 -0
- data/features/before_and_after_blocks/before_and_after_blocks.feature +169 -0
- data/features/expectations/customized_message.feature +54 -0
- data/features/matchers/define_matcher_outside_rspec.feature +39 -0
- data/features/mock_framework_integration/use_flexmock.feature +23 -0
- data/features/mock_framework_integration/use_mocha.feature +23 -0
- data/features/mock_framework_integration/use_rr.feature +23 -0
- data/features/mock_framework_integration/use_rspec.feature +23 -0
- data/features/step_definitions/running_rspec_steps.rb +35 -0
- data/features/subject/explicit_subject.feature +31 -0
- data/features/subject/implicit_subject.feature +31 -0
- data/features/support/env.rb +82 -0
- data/features/support/matchers/smart_match.rb +14 -0
- data/lib/rspec/autorun.rb +2 -0
- data/lib/rspec/core.rb +38 -0
- data/lib/rspec/core/backward_compatibility.rb +9 -0
- data/lib/rspec/core/command_line_options.rb +60 -0
- data/lib/rspec/core/configuration.rb +222 -0
- data/lib/rspec/core/deprecation.rb +47 -0
- data/lib/rspec/core/example.rb +113 -0
- data/lib/rspec/core/example_group.rb +239 -0
- data/lib/rspec/core/example_group_subject.rb +77 -0
- data/lib/rspec/core/formatters.rb +16 -0
- data/lib/rspec/core/formatters/base_formatter.rb +123 -0
- data/lib/rspec/core/formatters/base_text_formatter.rb +139 -0
- data/lib/rspec/core/formatters/documentation_formatter.rb +84 -0
- data/lib/rspec/core/formatters/progress_formatter.rb +36 -0
- data/lib/rspec/core/kernel_extensions.rb +15 -0
- data/lib/rspec/core/mocking/with_absolutely_nothing.rb +13 -0
- data/lib/rspec/core/mocking/with_flexmock.rb +25 -0
- data/lib/rspec/core/mocking/with_mocha.rb +22 -0
- data/lib/rspec/core/mocking/with_rr.rb +26 -0
- data/lib/rspec/core/mocking/with_rspec.rb +21 -0
- data/lib/rspec/core/rake_task.rb +88 -0
- data/lib/rspec/core/runner.rb +66 -0
- data/lib/rspec/core/shared_behaviour.rb +41 -0
- data/lib/rspec/core/shared_behaviour_kernel_extensions.rb +31 -0
- data/lib/rspec/core/version.rb +16 -0
- data/lib/rspec/core/world.rb +105 -0
- data/rspec-core.gemspec +204 -0
- data/script/console +8 -0
- data/spec/resources/example_classes.rb +67 -0
- data/spec/rspec/core/command_line_options_spec.rb +63 -0
- data/spec/rspec/core/configuration_spec.rb +171 -0
- data/spec/rspec/core/example_group_spec.rb +351 -0
- data/spec/rspec/core/example_group_subject_spec.rb +67 -0
- data/spec/rspec/core/example_spec.rb +67 -0
- data/spec/rspec/core/formatters/base_formatter_spec.rb +105 -0
- data/spec/rspec/core/formatters/documentation_formatter_spec.rb +5 -0
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +29 -0
- data/spec/rspec/core/kernel_extensions_spec.rb +13 -0
- data/spec/rspec/core/mocha_spec.rb +29 -0
- data/spec/rspec/core/resources/a_bar.rb +0 -0
- data/spec/rspec/core/resources/a_foo.rb +0 -0
- data/spec/rspec/core/resources/a_spec.rb +1 -0
- data/spec/rspec/core/resources/custom_example_group_runner.rb +14 -0
- data/spec/rspec/core/resources/example_classes.rb +67 -0
- data/spec/rspec/core/resources/utf8_encoded.rb +8 -0
- data/spec/rspec/core/runner_spec.rb +34 -0
- data/spec/rspec/core/shared_behaviour_spec.rb +185 -0
- data/spec/rspec/core/world_spec.rb +167 -0
- data/spec/rspec/core_spec.rb +35 -0
- data/spec/ruby_forker.rb +13 -0
- data/spec/spec_helper.rb +72 -0
- metadata +219 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require 'spec/spec_helper'
|
|
2
|
+
|
|
3
|
+
def describe_double(describes=Object)
|
|
4
|
+
group = Rspec::Core::ExampleGroup.describe(describes) {}
|
|
5
|
+
remove_last_describe_from_world
|
|
6
|
+
yield group if block_given?
|
|
7
|
+
group
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe Rspec::Core::ExampleGroupSubject do
|
|
11
|
+
|
|
12
|
+
describe "implicit subject" do
|
|
13
|
+
describe "with a class" do
|
|
14
|
+
it "returns an instance of the class" do
|
|
15
|
+
describe_double(Array).subject.call.should == []
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe "with a Module" do
|
|
20
|
+
it "returns the Module" do
|
|
21
|
+
describe_double(Enumerable).subject.call.should == Enumerable
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe "with a string" do
|
|
26
|
+
it "return the string" do
|
|
27
|
+
describe_double("Foo").subject.call.should == 'Foo'
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe "with a number" do
|
|
32
|
+
it "returns the number" do
|
|
33
|
+
describe_double(15).subject.call.should == 15
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
describe "explicit subject" do
|
|
40
|
+
describe "defined in a top level group" do
|
|
41
|
+
it "replaces the implicit subject in that group" do
|
|
42
|
+
group = describe_double(Array)
|
|
43
|
+
group.subject { [1,2,3] }
|
|
44
|
+
group.subject.call.should == [1,2,3]
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
describe "defined in a top level group" do
|
|
49
|
+
before do
|
|
50
|
+
@group = describe_double
|
|
51
|
+
@group.subject{ [4,5,6] }
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it "is available in a nested group (subclass)" do
|
|
55
|
+
nested = @group.describe("I'm nested!") { }
|
|
56
|
+
nested.subject.call.should == [4,5,6]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "is available in a doubly nested group (subclass)" do
|
|
60
|
+
nested_group = @group.describe("Nesting level 1") { }
|
|
61
|
+
doubly_nested_group = nested_group.describe("Nesting level 1") { }
|
|
62
|
+
doubly_nested_group.subject.call.should == [4,5,6]
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require 'spec/spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Rspec::Core::Example, :parent_metadata => 'sample' do
|
|
4
|
+
|
|
5
|
+
before do
|
|
6
|
+
behaviour = stub('behaviour', :metadata => { :behaviour => { :name => 'behaviour_name' }})
|
|
7
|
+
@example = Rspec::Core::Example.new(behaviour, 'description', {}, (lambda {}))
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe "attr readers" do
|
|
11
|
+
|
|
12
|
+
it "should have one for the parent behaviour" do
|
|
13
|
+
@example.should respond_to(:behaviour)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "should have one for it's description" do
|
|
17
|
+
@example.should respond_to(:description)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "should have one for it's metadata" do
|
|
21
|
+
@example.should respond_to(:metadata)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should have one for it's block" do
|
|
25
|
+
@example.should respond_to(:example_block)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe '#inspect' do
|
|
31
|
+
|
|
32
|
+
it "should return 'behaviour_name - description'" do
|
|
33
|
+
@example.inspect.should == 'behaviour_name - description'
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
describe '#to_s' do
|
|
39
|
+
|
|
40
|
+
it "should return #inspect" do
|
|
41
|
+
@example.to_s.should == @example.inspect
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
describe "accessing metadata within a running example" do
|
|
47
|
+
|
|
48
|
+
it "should have a reference to itself when running" do
|
|
49
|
+
running_example.description.should == "should have a reference to itself when running"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "should be able to access the behaviours top level metadata as if it were its own" do
|
|
53
|
+
running_example.behaviour.metadata.should include(:parent_metadata => 'sample')
|
|
54
|
+
running_example.metadata.should include(:parent_metadata => 'sample')
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
describe "#run" do
|
|
60
|
+
|
|
61
|
+
pending "should run after(:each) when the example fails"
|
|
62
|
+
|
|
63
|
+
pending "should run after(:each) when the example raises an Exception"
|
|
64
|
+
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
require 'spec/spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Rspec::Core::Formatters::BaseFormatter do
|
|
4
|
+
|
|
5
|
+
before do
|
|
6
|
+
@formatter = Rspec::Core::Formatters::BaseFormatter.new
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
class HaveInterfaceMatcher
|
|
10
|
+
def initialize(method)
|
|
11
|
+
@method = method
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
attr_reader :object
|
|
15
|
+
attr_reader :method
|
|
16
|
+
|
|
17
|
+
def matches?(object)
|
|
18
|
+
@object = object
|
|
19
|
+
object.respond_to?(@method)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def with(arity)
|
|
23
|
+
WithArity.new(self, @method, arity)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class WithArity
|
|
27
|
+
def initialize(matcher, method, arity)
|
|
28
|
+
@have_matcher = matcher
|
|
29
|
+
@method = method
|
|
30
|
+
@arity = arity
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def matches?(an_object)
|
|
34
|
+
@have_matcher.matches?(an_object) && real_arity == @arity
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def failure_message
|
|
38
|
+
"#{@have_matcher} should have method :#{@method} with #{argument_arity}, but it had #{real_arity}"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def arguments
|
|
42
|
+
self
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
alias_method :argument, :arguments
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def real_arity
|
|
50
|
+
@have_matcher.object.method(@method).arity
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def argument_arity
|
|
54
|
+
if @arity == 1
|
|
55
|
+
"1 argument"
|
|
56
|
+
else
|
|
57
|
+
"#{@arity} arguments"
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def have_interface_for(method)
|
|
64
|
+
HaveInterfaceMatcher.new(method)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it "should have start as an interface with one argument" do
|
|
68
|
+
@formatter.should have_interface_for(:start).with(1).argument
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it "should have add_behaviour as an interface with one argument" do
|
|
72
|
+
@formatter.should have_interface_for(:add_behaviour).with(1).argument
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it "should have example_finished as an interface with one argument" do
|
|
76
|
+
@formatter.should have_interface_for(:example_finished).with(1).arguments
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it "should have start_dump as an interface with 1 arguments" do
|
|
80
|
+
@formatter.should have_interface_for(:start_dump).with(1).arguments
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it "should have dump_failures as an interface with no arguments" do
|
|
84
|
+
@formatter.should have_interface_for(:dump_failures).with(0).arguments
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it "should have dump_summary as an interface with zero arguments" do
|
|
88
|
+
@formatter.should have_interface_for(:dump_summary).with(0).arguments
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it "should have dump_pending as an interface with zero arguments" do
|
|
92
|
+
@formatter.should have_interface_for(:dump_pending).with(0).arguments
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
it "should have close as an interface with zero arguments" do
|
|
96
|
+
@formatter.should have_interface_for(:close).with(0).arguments
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
describe '#format_backtrace' do
|
|
100
|
+
|
|
101
|
+
it "should display the full backtrace when the example is given the :full_backtrace => true option", :full_backtrace => true
|
|
102
|
+
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'spec/spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Rspec::Core::Formatters::ProgressFormatter do
|
|
4
|
+
|
|
5
|
+
before do
|
|
6
|
+
@output = StringIO.new
|
|
7
|
+
@formatter = Rspec::Core::Formatters::ProgressFormatter.new
|
|
8
|
+
@formatter.start(2)
|
|
9
|
+
@formatter.stubs(:color_enabled?).returns(false)
|
|
10
|
+
@formatter.stubs(:output).returns(@output)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should produce line break on start dump" do
|
|
14
|
+
@formatter.start_dump(3)
|
|
15
|
+
@output.string.should == "\n"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "should produce standard summary without pending when pending has a 0 count" do
|
|
19
|
+
@formatter.start_dump(3)
|
|
20
|
+
@formatter.dump_summary
|
|
21
|
+
@output.string.should =~ /Finished in 3 seconds\n2 examples/i
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should push nothing on start" do
|
|
25
|
+
@formatter.start(4)
|
|
26
|
+
@output.string.should == ""
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec/spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Rspec::Core::KernelExtensions do
|
|
4
|
+
|
|
5
|
+
it "should be included in Object" do
|
|
6
|
+
Object.included_modules.should include(Rspec::Core::KernelExtensions)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should add a describe method to Object" do
|
|
10
|
+
Object.should respond_to(:describe)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'spec/spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "Mocha Regression involving double reporting of errors" do
|
|
4
|
+
|
|
5
|
+
it "should not double report mocha errors" do
|
|
6
|
+
# The below example should have one error, not two
|
|
7
|
+
# I'm also not sure how to test this regression without having the failure counting by
|
|
8
|
+
# the running Rspec::Core instance
|
|
9
|
+
formatter = Rspec::Core::Formatters::BaseFormatter.new
|
|
10
|
+
|
|
11
|
+
use_formatter(formatter) do
|
|
12
|
+
|
|
13
|
+
isolate_behaviour do
|
|
14
|
+
desc = Rspec::Core::ExampleGroup.describe("my favorite pony") do
|
|
15
|
+
example("showing a double fail") do
|
|
16
|
+
foo = "string"
|
|
17
|
+
foo.expects(:something)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
desc.examples_to_run.replace(desc.examples)
|
|
21
|
+
desc.run(formatter)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
formatter.examples.size.should == 1
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Empty - used by ../options_spec.rb
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# This file contains various classes used by the specs.
|
|
2
|
+
module Rspec::Core
|
|
3
|
+
module Expectations
|
|
4
|
+
class Person
|
|
5
|
+
attr_reader :name
|
|
6
|
+
def initialize name
|
|
7
|
+
@name = name
|
|
8
|
+
end
|
|
9
|
+
def == other
|
|
10
|
+
return @name == other.name
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class ClassWithMultiWordPredicate
|
|
15
|
+
def multi_word_predicate?
|
|
16
|
+
true
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
module Helper
|
|
21
|
+
class CollectionWithSizeMethod
|
|
22
|
+
def initialize; @list = []; end
|
|
23
|
+
def size; @list.size; end
|
|
24
|
+
def push(item); @list.push(item); end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class CollectionWithLengthMethod
|
|
28
|
+
def initialize; @list = []; end
|
|
29
|
+
def length; @list.size; end
|
|
30
|
+
def push(item); @list.push(item); end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class CollectionOwner
|
|
34
|
+
attr_reader :items_in_collection_with_size_method, :items_in_collection_with_length_method
|
|
35
|
+
|
|
36
|
+
def initialize
|
|
37
|
+
@items_in_collection_with_size_method = CollectionWithSizeMethod.new
|
|
38
|
+
@items_in_collection_with_length_method = CollectionWithLengthMethod.new
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def add_to_collection_with_size_method(item)
|
|
42
|
+
@items_in_collection_with_size_method.push(item)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def add_to_collection_with_length_method(item)
|
|
46
|
+
@items_in_collection_with_length_method.push(item)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def items_for(arg)
|
|
50
|
+
return [1, 2, 3] if arg == 'a'
|
|
51
|
+
[1]
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def items
|
|
55
|
+
@items_in_collection_with_size_method
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
class ClassWithUnqueriedPredicate
|
|
60
|
+
attr_accessor :foo
|
|
61
|
+
def initialize(foo)
|
|
62
|
+
@foo = foo
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'spec/spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Rspec::Core::Runner do
|
|
4
|
+
|
|
5
|
+
describe 'formatter' do
|
|
6
|
+
|
|
7
|
+
it 'should return the configured formatter' do
|
|
8
|
+
Rspec::Core::Runner.new.formatter.should == Rspec::Core.configuration.formatter
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe 'at_exit' do
|
|
14
|
+
|
|
15
|
+
it 'should set an at_exit hook if none is already set' do
|
|
16
|
+
Rspec::Core::Runner.stubs(:installed_at_exit?).returns(false)
|
|
17
|
+
Rspec::Core::Runner.expects(:at_exit)
|
|
18
|
+
Rspec::Core::Runner.autorun
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'should not set the at_exit hook if it is already set' do
|
|
22
|
+
Rspec::Core::Runner.stubs(:installed_at_exit?).returns(true)
|
|
23
|
+
Rspec::Core::Runner.expects(:at_exit).never
|
|
24
|
+
Rspec::Core::Runner.autorun
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe 'placeholder' do
|
|
30
|
+
|
|
31
|
+
# it "should "
|
|
32
|
+
# Rspec::Core::Runner.new
|
|
33
|
+
end
|
|
34
|
+
end
|