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
data/spec/spec_suite.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "bundler"
|
3
|
-
require "session"
|
4
|
-
|
5
|
-
class ExampleSuite
|
6
|
-
attr_reader :bash
|
7
|
-
def initialize
|
8
|
-
@bash = Session::Bash.new
|
9
|
-
end
|
10
|
-
|
11
|
-
def run
|
12
|
-
run_core_examples
|
13
|
-
run_rspec_examples
|
14
|
-
run_test_unit_examples
|
15
|
-
run_minitest_examples
|
16
|
-
end
|
17
|
-
|
18
|
-
def run_core_examples
|
19
|
-
run_suite("#{dir}/core_spec_suite.rb #{spec_opts}") || raise("Core suite Failed")
|
20
|
-
end
|
21
|
-
|
22
|
-
def run_rspec_examples
|
23
|
-
run_suite("#{dir}/rspec_spec_suite.rb #{spec_opts}") || raise("Rspec suite Failed")
|
24
|
-
end
|
25
|
-
|
26
|
-
def run_test_unit_examples
|
27
|
-
run_suite("#{dir}/test_unit_spec_suite.rb") || raise("Test::Unit suite Failed")
|
28
|
-
end
|
29
|
-
|
30
|
-
def run_minitest_examples
|
31
|
-
run_suite("#{dir}/minitest_spec_suite.rb") || raise("MiniTest suite Failed")
|
32
|
-
end
|
33
|
-
|
34
|
-
def run_suite(path)
|
35
|
-
# From http://www.eglug.org/node/946
|
36
|
-
bash.execute "exec 3>&1", :out => STDOUT, :err => STDERR
|
37
|
-
bash.execute "ruby -W #{path} 2>&1 >&3 3>&- | grep -v 'warning: useless use of' 3>&-; STATUS=${PIPESTATUS[0]}", :out => STDOUT, :err => STDERR
|
38
|
-
status = bash.execute("echo $STATUS")[0].to_s.strip.to_i
|
39
|
-
bash.execute "exec 3>&-", :out => STDOUT, :err => STDERR
|
40
|
-
return status == 0
|
41
|
-
end
|
42
|
-
|
43
|
-
def spec_opts
|
44
|
-
File.read("#{dir}/spec.opts").split("\n").join(" ")
|
45
|
-
end
|
46
|
-
|
47
|
-
def dir
|
48
|
-
File.dirname(__FILE__)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
if $0 == __FILE__
|
53
|
-
ExampleSuite.new.run
|
54
|
-
end
|
@@ -1,129 +0,0 @@
|
|
1
|
-
require File.expand_path("#{File.dirname(__FILE__)}/spec_helper")
|
2
|
-
|
3
|
-
class Alpha
|
4
|
-
def bob
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
describe RR::SpyVerification do
|
9
|
-
attr_reader :subject, :recorded_calls
|
10
|
-
it_should_behave_like "Swapped Space"
|
11
|
-
before(:each) do
|
12
|
-
@subject = Object.new
|
13
|
-
extend RR::Adapters::RRMethods
|
14
|
-
stub(subject).foobar
|
15
|
-
@recorded_calls = RR::RecordedCalls.new([[subject, :foobar, [1, 2], nil]])
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "#call" do
|
19
|
-
context "when a subject is expected to receive a method with exact arguments" do
|
20
|
-
context "when the number of times the subject received a method is not specified" do
|
21
|
-
context "when there is an exact match one time" do
|
22
|
-
it "verifies that the method with arguments was called once" do
|
23
|
-
subject.foobar(1, 2)
|
24
|
-
received(subject).foobar(1, 2).call
|
25
|
-
subject.foobar(1, 2)
|
26
|
-
lambda do
|
27
|
-
received(subject).foobar(1, 2).call
|
28
|
-
end.should raise_error(RR::Errors::SpyVerificationErrors::InvocationCountError)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "when the number of times the subject received a method is specified" do
|
34
|
-
context "as one time" do
|
35
|
-
it "verifies that the method with arugments was called once" do
|
36
|
-
subject.foobar(1, 2)
|
37
|
-
received(subject).foobar(1, 2).once.call
|
38
|
-
subject.foobar(1, 2)
|
39
|
-
lambda do
|
40
|
-
received(subject).foobar(1, 2).once.call
|
41
|
-
end.should raise_error(RR::Errors::SpyVerificationErrors::InvocationCountError)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context "as an at least matcher" do
|
46
|
-
it "verifies that the method with arugments was called at least the specified number of times" do
|
47
|
-
subject.foobar(1, 2)
|
48
|
-
lambda do
|
49
|
-
received(subject).foobar(1, 2).at_least(2).call
|
50
|
-
end.should raise_error(RR::Errors::SpyVerificationErrors::InvocationCountError)
|
51
|
-
subject.foobar(1, 2)
|
52
|
-
received(subject).foobar(1, 2).at_least(2).call
|
53
|
-
subject.foobar(1, 2)
|
54
|
-
received(subject).foobar(1, 2).at_least(2).call
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context "when a subject is expected to receive a method with wildcard arguments" do
|
61
|
-
context "when the number of times the subject received a method is not specified" do
|
62
|
-
context "when there is a wildcard match one time" do
|
63
|
-
it "verifies that the method with arguments was called once" do
|
64
|
-
subject.foobar(1, 2)
|
65
|
-
received(subject).foobar(1, is_a(Fixnum)).call
|
66
|
-
subject.foobar(1, 2)
|
67
|
-
lambda do
|
68
|
-
received(subject).foobar(1, is_a(Fixnum)).call
|
69
|
-
end.should raise_error(RR::Errors::SpyVerificationErrors::InvocationCountError)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
context "when the number of times the subject received a method is specified" do
|
75
|
-
context "as one time" do
|
76
|
-
it "verifies that the method with arugments was called once" do
|
77
|
-
subject.foobar(1, 2)
|
78
|
-
received(subject).foobar(1, is_a(Fixnum)).once.call
|
79
|
-
subject.foobar(1, 2)
|
80
|
-
lambda do
|
81
|
-
received(subject).foobar(1, is_a(Fixnum)).once.call
|
82
|
-
end.should raise_error(RR::Errors::SpyVerificationErrors::InvocationCountError)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
context "as an at least matcher" do
|
87
|
-
it "verifies that the method with arugments was called at least the specified number of times" do
|
88
|
-
subject.foobar(1, is_a(Fixnum))
|
89
|
-
lambda do
|
90
|
-
received(subject).foobar(1, is_a(Fixnum)).at_least(2).call
|
91
|
-
end.should raise_error(RR::Errors::SpyVerificationErrors::InvocationCountError)
|
92
|
-
subject.foobar(1, 2)
|
93
|
-
received(subject).foobar(1, is_a(Fixnum)).at_least(2).call
|
94
|
-
subject.foobar(1, 2)
|
95
|
-
received(subject).foobar(1, is_a(Fixnum)).at_least(2).call
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
context "when checking for ordering" do
|
102
|
-
it "when the order is incorrect; raises an error" do
|
103
|
-
subject.foobar(3, 4)
|
104
|
-
subject.foobar(1, 2)
|
105
|
-
lambda do
|
106
|
-
received(subject).foobar(1, 2).ordered.call
|
107
|
-
received(subject).foobar(3, 4).ordered.call
|
108
|
-
end.should raise_error(RR::Errors::SpyVerificationErrors::InvocationCountError)
|
109
|
-
end
|
110
|
-
|
111
|
-
it "when the order is correct; does not raise an error" do
|
112
|
-
subject.foobar(1, 2)
|
113
|
-
subject.foobar(1, 2)
|
114
|
-
subject.foobar(3, 4)
|
115
|
-
received(subject).foobar(1, 2).ordered.call
|
116
|
-
received(subject).foobar(3, 4).ordered.call
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
context "when the subject is expected where there is not DoubleInjection" do
|
121
|
-
it "raises a DoubleInjectionNotFoundError" do
|
122
|
-
::RR::Injections::DoubleInjection.exists?(subject, :method_that_does_not_exist).should be_false
|
123
|
-
lambda do
|
124
|
-
received(subject).method_that_does_not_exist.call
|
125
|
-
end.should raise_error(RR::Errors::SpyVerificationErrors::DoubleInjectionNotFoundError)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "spec"
|
3
|
-
|
4
|
-
class TestUnitTestSuite
|
5
|
-
def run
|
6
|
-
require_tests
|
7
|
-
|
8
|
-
puts "Running Test::Unit Test Suite"
|
9
|
-
end
|
10
|
-
|
11
|
-
def require_tests
|
12
|
-
dir = File.dirname(__FILE__)
|
13
|
-
Dir["#{dir}/rr/test_unit/**/*_test.rb"].each do |file|
|
14
|
-
require File.expand_path(file)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
if $0 == __FILE__
|
20
|
-
TestUnitTestSuite.new.run
|
21
|
-
end
|