rr 1.0.4 → 1.0.5.rc1
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.
- checksums.yaml +15 -0
- data/CHANGES.md +376 -0
- data/Gemfile +7 -10
- data/README.md +822 -0
- data/Rakefile +24 -78
- data/VERSION +1 -0
- data/lib/rr.rb +3 -0
- data/lib/rr/adapters/minitest.rb +6 -0
- data/lib/rr/adapters/rr_methods.rb +6 -10
- data/lib/rr/adapters/rspec.rb +3 -0
- data/lib/rr/adapters/rspec2.rb +30 -0
- data/lib/rr/adapters/test_unit.rb +2 -0
- data/lib/rr/double.rb +3 -2
- data/lib/rr/double_definitions/child_double_definition_create.rb +3 -2
- data/lib/rr/double_definitions/double_definition.rb +15 -13
- data/lib/rr/double_definitions/double_definition_create.rb +9 -5
- data/lib/rr/double_definitions/double_injections/any_instance_of.rb +3 -2
- data/lib/rr/double_definitions/strategies/strategy.rb +5 -4
- data/lib/rr/double_definitions/strategies/strategy_methods.rb +6 -8
- data/lib/rr/double_definitions/strategies/verification/mock.rb +3 -3
- data/lib/rr/double_matches.rb +2 -1
- data/lib/rr/expectations/argument_equality_expectation.rb +2 -2
- data/lib/rr/expectations/times_called_expectation.rb +2 -2
- data/lib/rr/injections/double_injection.rb +12 -11
- data/lib/rr/injections/injection.rb +2 -2
- data/lib/rr/injections/method_missing_injection.rb +21 -7
- data/lib/rr/injections/singleton_method_added_injection.rb +3 -1
- data/lib/rr/method_dispatches/base_method_dispatch.rb +1 -1
- data/lib/rr/method_dispatches/method_dispatch.rb +2 -1
- data/lib/rr/method_dispatches/method_missing_dispatch.rb +2 -1
- data/lib/rr/proc_from_block.rb +8 -4
- data/lib/rr/space.rb +3 -2
- data/lib/rr/times_called_matchers/times_called_matcher.rb +2 -2
- data/lib/rr/version.rb +5 -0
- data/lib/rr/wildcard_matchers/boolean.rb +2 -2
- data/spec/runner.rb +41 -0
- metadata +45 -133
- data/.gitignore +0 -10
- data/.runrc +0 -3
- data/.rvmrc +0 -2
- data/CHANGES +0 -266
- data/Gemfile.lock +0 -31
- data/README.rdoc +0 -392
- data/benchmarks/rr_benchmark.rb +0 -32
- data/benchmarks/rspec_benchmark.rb +0 -14
- data/doc/0.6.0.release.markdown +0 -81
- data/doc/todo.txt +0 -0
- data/introducting_rr.txt +0 -206
- data/rr.gemspec +0 -37
- data/spec/api/any_instance_of/all_instances_of_spec.rb +0 -12
- data/spec/api/any_instance_of/any_instance_of_spec.rb +0 -47
- data/spec/api/any_instance_of/instance_of_spec.rb +0 -12
- data/spec/api/dont_allow/dont_allow_after_stub_spec.rb +0 -14
- data/spec/api/mock/mock_spec.rb +0 -193
- data/spec/api/proxy/proxy_spec.rb +0 -86
- data/spec/api/spy/spy_spec.rb +0 -49
- data/spec/api/strong/strong_spec.rb +0 -87
- data/spec/api/stub/stub_spec.rb +0 -152
- data/spec/core_spec_suite.rb +0 -19
- data/spec/environment_fixture_setup.rb +0 -8
- data/spec/minitest_spec_suite.rb +0 -21
- data/spec/proc_from_block_spec.rb +0 -14
- data/spec/rr/adapters/rr_methods_argument_matcher_spec.rb +0 -67
- data/spec/rr/adapters/rr_methods_creator_spec.rb +0 -137
- data/spec/rr/adapters/rr_methods_space_spec.rb +0 -98
- data/spec/rr/adapters/rr_methods_spec_helper.rb +0 -11
- data/spec/rr/adapters/rr_methods_times_matcher_spec.rb +0 -13
- data/spec/rr/double_definitions/child_double_definition_creator_spec.rb +0 -112
- data/spec/rr/double_definitions/double_definition_create_blank_slate_spec.rb +0 -91
- data/spec/rr/double_definitions/double_definition_create_spec.rb +0 -443
- data/spec/rr/double_injection/double_injection_spec.rb +0 -546
- data/spec/rr/double_injection/double_injection_verify_spec.rb +0 -29
- data/spec/rr/errors/rr_error_spec.rb +0 -67
- data/spec/rr/expectations/any_argument_expectation_spec.rb +0 -47
- data/spec/rr/expectations/anything_argument_equality_expectation_spec.rb +0 -14
- data/spec/rr/expectations/argument_equality_expectation_spec.rb +0 -135
- data/spec/rr/expectations/boolean_argument_equality_expectation_spec.rb +0 -34
- data/spec/rr/expectations/hash_including_argument_equality_expectation_spec.rb +0 -82
- data/spec/rr/expectations/hash_including_spec.rb +0 -17
- data/spec/rr/expectations/satisfy_argument_equality_expectation_spec.rb +0 -59
- data/spec/rr/expectations/satisfy_spec.rb +0 -14
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_any_times_spec.rb +0 -22
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_least_spec.rb +0 -37
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_most_spec.rb +0 -43
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_helper.rb +0 -15
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_integer_spec.rb +0 -58
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_proc_spec.rb +0 -35
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb +0 -39
- data/spec/rr/minitest/minitest_integration_test.rb +0 -59
- data/spec/rr/minitest/test_helper.rb +0 -7
- data/spec/rr/rspec/invocation_matcher_spec.rb +0 -279
- data/spec/rr/rspec/rspec_adapter_spec.rb +0 -63
- data/spec/rr/rspec/rspec_backtrace_tweaking_spec.rb +0 -31
- data/spec/rr/rspec/rspec_backtrace_tweaking_spec_fixture.rb +0 -11
- data/spec/rr/rspec/rspec_usage_spec.rb +0 -86
- data/spec/rr/space/hash_with_object_id_key_spec.rb +0 -88
- data/spec/rr/space/space_spec.rb +0 -596
- data/spec/rr/test_unit/test_helper.rb +0 -7
- data/spec/rr/test_unit/test_unit_backtrace_test.rb +0 -36
- data/spec/rr/test_unit/test_unit_integration_test.rb +0 -59
- data/spec/rr/times_called_matchers/any_times_matcher_spec.rb +0 -47
- data/spec/rr/times_called_matchers/at_least_matcher_spec.rb +0 -55
- data/spec/rr/times_called_matchers/at_most_matcher_spec.rb +0 -70
- data/spec/rr/times_called_matchers/integer_matcher_spec.rb +0 -70
- data/spec/rr/times_called_matchers/proc_matcher_spec.rb +0 -55
- data/spec/rr/times_called_matchers/range_matcher_spec.rb +0 -76
- data/spec/rr/times_called_matchers/times_called_matcher_spec.rb +0 -118
- data/spec/rr/wildcard_matchers/anything_spec.rb +0 -24
- data/spec/rr/wildcard_matchers/boolean_spec.rb +0 -36
- data/spec/rr/wildcard_matchers/duck_type_spec.rb +0 -52
- data/spec/rr/wildcard_matchers/is_a_spec.rb +0 -32
- data/spec/rr/wildcard_matchers/numeric_spec.rb +0 -32
- data/spec/rr/wildcard_matchers/range_spec.rb +0 -35
- data/spec/rr/wildcard_matchers/regexp_spec.rb +0 -43
- data/spec/rr_spec.rb +0 -28
- data/spec/rspec_spec_suite.rb +0 -17
- data/spec/spec.opts +0 -10
- data/spec/spec_helper.rb +0 -41
- data/spec/spec_suite.rb +0 -54
- data/spec/spy_verification_spec.rb +0 -129
- data/spec/test_unit_spec_suite.rb +0 -21
@@ -1,86 +0,0 @@
|
|
1
|
-
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
|
2
|
-
|
3
|
-
describe "proxy" do
|
4
|
-
attr_reader :subject
|
5
|
-
before(:each) do
|
6
|
-
@subject = Object.new
|
7
|
-
extend RR::Adapters::RRMethods
|
8
|
-
end
|
9
|
-
|
10
|
-
after(:each) do
|
11
|
-
RR.reset
|
12
|
-
end
|
13
|
-
|
14
|
-
it "proxies via inline call" do
|
15
|
-
expected_to_s_value = subject.to_s
|
16
|
-
mock.proxy(subject).to_s
|
17
|
-
subject.to_s.should == expected_to_s_value
|
18
|
-
lambda {subject.to_s}.should raise_error
|
19
|
-
end
|
20
|
-
|
21
|
-
it "proxy allows ordering" do
|
22
|
-
def subject.to_s(arg)
|
23
|
-
"Original to_s with arg #{arg}"
|
24
|
-
end
|
25
|
-
mock.proxy(subject).to_s(:foo).ordered
|
26
|
-
mock.proxy(subject).to_s(:bar).twice.ordered
|
27
|
-
|
28
|
-
subject.to_s(:foo).should == "Original to_s with arg foo"
|
29
|
-
subject.to_s(:bar).should == "Original to_s with arg bar"
|
30
|
-
subject.to_s(:bar).should == "Original to_s with arg bar"
|
31
|
-
lambda {subject.to_s(:bar)}.should raise_error(RR::Errors::TimesCalledError)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "proxy allows ordering" do
|
35
|
-
def subject.to_s(arg)
|
36
|
-
"Original to_s with arg #{arg}"
|
37
|
-
end
|
38
|
-
mock.proxy(subject).to_s(:foo).ordered
|
39
|
-
mock.proxy(subject).to_s(:bar).twice.ordered
|
40
|
-
|
41
|
-
subject.to_s(:foo).should == "Original to_s with arg foo"
|
42
|
-
subject.to_s(:bar).should == "Original to_s with arg bar"
|
43
|
-
subject.to_s(:bar).should == "Original to_s with arg bar"
|
44
|
-
lambda {subject.to_s(:bar)}.should raise_error(RR::Errors::TimesCalledError)
|
45
|
-
end
|
46
|
-
|
47
|
-
it "proxies via block with argument" do
|
48
|
-
def subject.foobar_1(*args)
|
49
|
-
:original_value_1
|
50
|
-
end
|
51
|
-
|
52
|
-
def subject.foobar_2
|
53
|
-
:original_value_2
|
54
|
-
end
|
55
|
-
|
56
|
-
mock.proxy subject do |c|
|
57
|
-
c.foobar_1(1)
|
58
|
-
c.foobar_2
|
59
|
-
end
|
60
|
-
subject.foobar_1(1).should == :original_value_1
|
61
|
-
lambda {subject.foobar_1(:blah)}.should raise_error
|
62
|
-
|
63
|
-
subject.foobar_2.should == :original_value_2
|
64
|
-
lambda {subject.foobar_2(:blah)}.should raise_error
|
65
|
-
end
|
66
|
-
|
67
|
-
it "proxies via block without argument" do
|
68
|
-
def subject.foobar_1(*args)
|
69
|
-
:original_value_1
|
70
|
-
end
|
71
|
-
|
72
|
-
def subject.foobar_2
|
73
|
-
:original_value_2
|
74
|
-
end
|
75
|
-
|
76
|
-
mock.proxy subject do
|
77
|
-
foobar_1(1)
|
78
|
-
foobar_2
|
79
|
-
end
|
80
|
-
subject.foobar_1(1).should == :original_value_1
|
81
|
-
lambda {subject.foobar_1(:blah)}.should raise_error
|
82
|
-
|
83
|
-
subject.foobar_2.should == :original_value_2
|
84
|
-
lambda {subject.foobar_2(:blah)}.should raise_error
|
85
|
-
end
|
86
|
-
end
|
data/spec/api/spy/spy_spec.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
|
2
|
-
|
3
|
-
describe "spy" do
|
4
|
-
attr_reader :subject
|
5
|
-
before(:each) do
|
6
|
-
@subject = Object.new
|
7
|
-
extend RR::Adapters::RRMethods
|
8
|
-
end
|
9
|
-
|
10
|
-
after(:each) do
|
11
|
-
RR.reset
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should record all method invocations" do
|
15
|
-
subject = Object.new
|
16
|
-
|
17
|
-
def subject.something
|
18
|
-
end
|
19
|
-
|
20
|
-
def subject.something_else
|
21
|
-
end
|
22
|
-
|
23
|
-
spy(subject)
|
24
|
-
|
25
|
-
subject.something
|
26
|
-
subject.something_else
|
27
|
-
subject.to_s
|
28
|
-
|
29
|
-
received(subject).something.call
|
30
|
-
received(subject).something_else.call
|
31
|
-
received(subject).to_s.call
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "RR recorded_calls" do
|
35
|
-
it "should verify method calls after the fact" do
|
36
|
-
stub(subject).pig_rabbit
|
37
|
-
subject.pig_rabbit("bacon", "bunny meat")
|
38
|
-
#subject.should have_received.pig_rabitt("bacon", "bunny meat")
|
39
|
-
received(subject).pig_rabbit("bacon", "bunny meat").call
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should verify method calls after the fact" do
|
43
|
-
stub(subject).pig_rabbit
|
44
|
-
lambda do
|
45
|
-
received(subject).pig_rabbit("bacon", "bunny meat").call
|
46
|
-
end.should raise_error(RR::Errors::SpyVerificationErrors::SpyVerificationError)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,87 +0,0 @@
|
|
1
|
-
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
|
2
|
-
|
3
|
-
class StrongSpecFixture
|
4
|
-
def method_with_no_arguments
|
5
|
-
end
|
6
|
-
|
7
|
-
def method_with_one_argument(string)
|
8
|
-
end
|
9
|
-
|
10
|
-
def method_with_two_arguments(string, integer)
|
11
|
-
end
|
12
|
-
|
13
|
-
def method_with_three_arguments_including_varargs(string, integer, *args)
|
14
|
-
end
|
15
|
-
|
16
|
-
def method_with_varargs(*args)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "strong" do
|
21
|
-
attr_reader :subject
|
22
|
-
before(:each) do
|
23
|
-
@subject = Object.new
|
24
|
-
extend RR::Adapters::RRMethods
|
25
|
-
end
|
26
|
-
|
27
|
-
after(:each) do
|
28
|
-
RR.reset
|
29
|
-
end
|
30
|
-
|
31
|
-
context "when the method does not exist" do
|
32
|
-
it "raises an exception" do
|
33
|
-
lambda do
|
34
|
-
strong.stub(StrongSpecFixture.new).something
|
35
|
-
end.should raise_error(RR::Errors::SubjectDoesNotImplementMethodError)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context "when the method exists with no arguments" do
|
40
|
-
it "does not raise an exception" do
|
41
|
-
strong.stub(StrongSpecFixture.new).method_with_no_arguments
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context "when the method has a different arity" do
|
46
|
-
it "raises an exception" do
|
47
|
-
lambda do
|
48
|
-
strong.stub(StrongSpecFixture.new).method_with_one_argument
|
49
|
-
end.should raise_error(RR::Errors::SubjectHasDifferentArityError)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
context "when the method has accepts a variable number of arguments" do
|
54
|
-
it "does not raise an exception" do
|
55
|
-
strong.stub(StrongSpecFixture.new).method_with_varargs
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
context "when the method does not provide the required parameters before varargs" do
|
60
|
-
it "raises an exception" do
|
61
|
-
lambda do
|
62
|
-
strong.stub(StrongSpecFixture.new).method_with_three_arguments_including_varargs
|
63
|
-
end.should raise_error(RR::Errors::SubjectHasDifferentArityError)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
context "when the minimum number of parameters are provided" do
|
68
|
-
it "does not raise an exception" do
|
69
|
-
strong.stub(StrongSpecFixture.new).method_with_three_arguments_including_varargs("one", 2)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context "when using instance_of and the method does not exist" do
|
74
|
-
it "raises an exception" do
|
75
|
-
lambda do
|
76
|
-
strong.stub.instance_of(StrongSpecFixture).something
|
77
|
-
StrongSpecFixture.new
|
78
|
-
end.should raise_error(RR::Errors::SubjectDoesNotImplementMethodError)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
context "when using instance_of and the method does exist" do
|
83
|
-
it "does not raise an exception" do
|
84
|
-
strong.stub.instance_of(StrongSpecFixture).method_with_no_arguments
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
data/spec/api/stub/stub_spec.rb
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
|
2
|
-
|
3
|
-
class StubSpecFixture
|
4
|
-
attr_reader :initialize_arguments
|
5
|
-
|
6
|
-
def initialize(*args)
|
7
|
-
@initialize_arguments = args
|
8
|
-
yield if block_given?
|
9
|
-
method_run_in_initialize
|
10
|
-
end
|
11
|
-
|
12
|
-
def method_run_in_initialize
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "stub" do
|
18
|
-
attr_reader :subject
|
19
|
-
before(:each) do
|
20
|
-
@subject = Object.new
|
21
|
-
extend RR::Adapters::RRMethods
|
22
|
-
end
|
23
|
-
|
24
|
-
after(:each) do
|
25
|
-
RR.reset
|
26
|
-
end
|
27
|
-
|
28
|
-
it "stubs via inline call" do
|
29
|
-
stub(subject).to_s {"a value"}
|
30
|
-
subject.to_s.should == "a value"
|
31
|
-
end
|
32
|
-
|
33
|
-
describe ".once.ordered" do
|
34
|
-
it "returns the values in the ordered called" do
|
35
|
-
stub(subject).to_s {"value 1"}.once.ordered
|
36
|
-
stub(subject).to_s {"value 2"}.once.ordered
|
37
|
-
|
38
|
-
subject.to_s.should == "value 1"
|
39
|
-
subject.to_s.should == "value 2"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context "when the subject is a proxy for the object with the defined method" do
|
44
|
-
it "stubs the method on the proxy object" do
|
45
|
-
proxy_target = Class.new {def foobar; :original_foobar; end}.new
|
46
|
-
proxy = Class.new do
|
47
|
-
def initialize(target)
|
48
|
-
@target = target
|
49
|
-
end
|
50
|
-
|
51
|
-
instance_methods.each do |m|
|
52
|
-
unless m =~ /^_/ || m.to_s == 'object_id' || m.to_s == 'method_missing'
|
53
|
-
alias_method "__blank_slated_#{m}", m
|
54
|
-
undef_method m
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def method_missing(method_name, *args, &block)
|
59
|
-
@target.send(method_name, *args, &block)
|
60
|
-
end
|
61
|
-
end.new(proxy_target)
|
62
|
-
proxy.methods.should =~ proxy_target.methods
|
63
|
-
|
64
|
-
stub(proxy).foobar {:new_foobar}
|
65
|
-
proxy.foobar.should == :new_foobar
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
it "stubs via block with argument" do
|
70
|
-
stub subject do |d|
|
71
|
-
d.to_s {"a value"}
|
72
|
-
d.to_sym {:crazy}
|
73
|
-
end
|
74
|
-
subject.to_s.should == "a value"
|
75
|
-
subject.to_sym.should == :crazy
|
76
|
-
end
|
77
|
-
|
78
|
-
it "stubs via block without argument" do
|
79
|
-
stub subject do
|
80
|
-
to_s {"a value"}
|
81
|
-
to_sym {:crazy}
|
82
|
-
end
|
83
|
-
subject.to_s.should == "a value"
|
84
|
-
subject.to_sym.should == :crazy
|
85
|
-
end
|
86
|
-
|
87
|
-
it "stubs instance_of" do
|
88
|
-
stub.instance_of(StubSpecFixture) do |o|
|
89
|
-
o.to_s {"High Level Spec"}
|
90
|
-
end
|
91
|
-
StubSpecFixture.new.to_s.should == "High Level Spec"
|
92
|
-
end
|
93
|
-
|
94
|
-
it "stubs methods without letters" do
|
95
|
-
stub(subject).__send__(:==) {:equality}
|
96
|
-
(subject == 55).should == :equality
|
97
|
-
end
|
98
|
-
|
99
|
-
it "stubs methods invoked in #initialize while passing along the #initialize arg" do
|
100
|
-
method_run_in_initialize_stubbed = false
|
101
|
-
stub.instance_of(StubSpecFixture) do |o|
|
102
|
-
o.method_run_in_initialize {method_run_in_initialize_stubbed = true}
|
103
|
-
end
|
104
|
-
StubSpecFixture.new
|
105
|
-
method_run_in_initialize_stubbed.should be_true
|
106
|
-
end
|
107
|
-
|
108
|
-
it "passed the arguments and block passed to #initialize" do
|
109
|
-
block_called = false
|
110
|
-
stub.instance_of(StubSpecFixture) do |o|
|
111
|
-
o.method_run_in_initialize
|
112
|
-
end
|
113
|
-
instance = StubSpecFixture.new(1, 2) {block_called = true}
|
114
|
-
instance.initialize_arguments.should == [1, 2]
|
115
|
-
block_called.should be_true
|
116
|
-
end
|
117
|
-
|
118
|
-
context "mock then stub" do
|
119
|
-
it "stubs any calls not matching the mock" do
|
120
|
-
mock(subject).foobar(3) {:baz3}
|
121
|
-
stub(subject).foobar {:baz}
|
122
|
-
subject.foobar(3).should == :baz3
|
123
|
-
subject.foobar(4).should == :baz
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
context "stub that yields" do
|
128
|
-
context "when yields called without any arguments" do
|
129
|
-
it "yields only once" do
|
130
|
-
called_from_block = mock!.foo.once.subject
|
131
|
-
block_caller = stub!.bar.yields.subject
|
132
|
-
block_caller.bar { called_from_block.foo }
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
context "when yields called with an argument" do
|
137
|
-
it "yields only once" do
|
138
|
-
called_from_block = mock!.foo(1).once.subject
|
139
|
-
block_caller = stub!.bar.yields(1).subject
|
140
|
-
block_caller.bar { |argument| called_from_block.foo(argument) }
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
context "when yields calls are chained" do
|
145
|
-
it "yields several times" do
|
146
|
-
called_from_block = mock!.foo(1).once.then.foo(2).once.subject
|
147
|
-
block_caller = stub!.bar.yields(1).yields(2).subject
|
148
|
-
block_caller.bar { |argument| called_from_block.foo(argument) }
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|
152
|
-
end
|
data/spec/core_spec_suite.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "spec"
|
3
|
-
|
4
|
-
class CoreExampleSuite
|
5
|
-
def run
|
6
|
-
files = Dir["#{File.dirname(__FILE__)}/**/*_spec.rb"]
|
7
|
-
files.delete_if {|file| file.include?('rspec/')}
|
8
|
-
files.delete_if {|file| file.include?('test_unit/')}
|
9
|
-
puts "Running Rspec Example Suite"
|
10
|
-
files.each do |file|
|
11
|
-
require File.expand_path(file)
|
12
|
-
# puts "require '#{file}'"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
if $0 == __FILE__
|
18
|
-
CoreExampleSuite.new.run
|
19
|
-
end
|
data/spec/minitest_spec_suite.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "spec"
|
3
|
-
|
4
|
-
class MiniTestTestSuite
|
5
|
-
def run
|
6
|
-
require_tests
|
7
|
-
|
8
|
-
puts "Running MiniTest Test Suite"
|
9
|
-
end
|
10
|
-
|
11
|
-
def require_tests
|
12
|
-
dir = File.dirname(__FILE__)
|
13
|
-
Dir["#{dir}/rr/minitest/**/*_test.rb"].each do |file|
|
14
|
-
require File.expand_path(file)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
if $0 == __FILE__
|
20
|
-
MiniTestTestSuite.new.run
|
21
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require File.expand_path("#{File.dirname(__FILE__)}/spec_helper")
|
2
|
-
|
3
|
-
module RR
|
4
|
-
describe ProcFromBlock do
|
5
|
-
describe "#==" do
|
6
|
-
it "acts the same as #== on a Proc" do
|
7
|
-
original_proc = lambda {}
|
8
|
-
Proc.new(&original_proc).should == original_proc
|
9
|
-
|
10
|
-
ProcFromBlock.new(&original_proc).should == original_proc
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|