rr 0.10.10 → 0.10.11
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +4 -0
- data/VERSION.yml +1 -1
- data/lib/rr.rb +5 -3
- data/lib/rr/adapters/rr_methods.rb +5 -5
- data/lib/rr/blank_slate.rb +17 -0
- data/lib/rr/double_definitions/{child_double_definition_creator.rb → child_double_definition_create.rb} +1 -1
- data/lib/rr/double_definitions/double_definition.rb +13 -11
- data/lib/rr/double_definitions/{double_definition_creator.rb → double_definition_create.rb} +52 -43
- data/lib/rr/double_definitions/double_definition_create_blank_slate.rb +26 -0
- data/lib/rr/double_definitions/strategies/implementation/implementation_strategy.rb +2 -2
- data/lib/rr/double_definitions/strategies/scope/instance.rb +1 -1
- data/lib/rr/double_definitions/strategies/scope/instance_of_class.rb +6 -6
- data/lib/rr/double_definitions/strategies/scope/scope_strategy.rb +2 -2
- data/lib/rr/double_definitions/strategies/strategy.rb +15 -16
- data/lib/rr/double_definitions/strategies/verification/mock.rb +1 -1
- data/lib/rr/double_definitions/strategies/verification/stub.rb +1 -1
- data/lib/rr/double_definitions/strategies/verification/verification_strategy.rb +2 -2
- data/lib/rr/injections/double_injection.rb +59 -4
- data/lib/rr/injections/injection.rb +6 -0
- data/lib/rr/injections/method_missing_injection.rb +13 -1
- data/lib/rr/injections/singleton_method_added_injection.rb +14 -3
- data/lib/rr/method_dispatches/base_method_dispatch.rb +2 -2
- data/lib/rr/method_dispatches/method_missing_dispatch.rb +2 -2
- data/lib/rr/recorded_calls.rb +1 -1
- data/lib/rr/space.rb +17 -68
- data/lib/rr/spy_verification_proxy.rb +1 -6
- data/spec/rr/adapters/rr_methods_creator_spec.rb +9 -21
- data/spec/rr/adapters/rr_methods_space_spec.rb +10 -25
- data/spec/rr/double_definitions/child_double_definition_creator_spec.rb +16 -16
- data/spec/rr/double_definitions/double_definition_create_blank_slate_spec.rb +87 -0
- data/spec/rr/double_definitions/{double_definition_creator_spec.rb → double_definition_create_spec.rb} +64 -72
- data/spec/rr/double_injection/double_injection_verify_spec.rb +2 -2
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_any_times_spec.rb +5 -29
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_least_spec.rb +7 -39
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_most_spec.rb +19 -47
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_helper.rb +1 -9
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_integer_spec.rb +18 -64
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_proc_spec.rb +7 -53
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb +12 -56
- data/spec/rr/rspec/rspec_adapter_spec.rb +8 -11
- data/spec/rr/space/space_spec.rb +72 -212
- data/spec/spec_helper.rb +0 -76
- data/spec/spy_verification_spec.rb +1 -1
- metadata +8 -11
- data/lib/rr/double_definitions/double_definition_creator_proxy.rb +0 -37
- data/ruby_19_spec.rb +0 -12
- data/spec/rr/double_definitions/double_definition_creator_proxy_spec.rb +0 -124
- data/spec/rr/double_definitions/double_definition_spec.rb +0 -1168
- data/spec/rr/double_spec.rb +0 -361
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb +0 -38
@@ -9,13 +9,13 @@ module RR
|
|
9
9
|
@subject = Object.new
|
10
10
|
@method_name = :foobar
|
11
11
|
subject.methods.should_not include(method_name.to_s)
|
12
|
-
@double_injection =
|
12
|
+
@double_injection = Injections::DoubleInjection.create(subject, method_name)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "verifies each double was met" do
|
16
16
|
double = RR::Double.new(
|
17
17
|
double_injection,
|
18
|
-
RR::DoubleDefinitions::DoubleDefinition.new(RR::DoubleDefinitions::
|
18
|
+
RR::DoubleDefinitions::DoubleDefinition.new(RR::DoubleDefinitions::DoubleDefinitionCreate.new)
|
19
19
|
)
|
20
20
|
double_injection.register_double double
|
21
21
|
|
data/spec/rr/expectations/times_called_expectation/times_called_expectation_any_times_spec.rb
CHANGED
@@ -5,39 +5,15 @@ module RR
|
|
5
5
|
describe TimesCalledExpectation do
|
6
6
|
context "when using an AnyTimesMatcher" do
|
7
7
|
it_should_behave_like "RR::Expectations::TimesCalledExpectation"
|
8
|
-
attr_reader :matcher, :expectation
|
9
|
-
|
10
|
-
before do
|
11
|
-
double.definition.any_number_of_times
|
12
|
-
@matcher = double.definition.times_matcher
|
13
|
-
@expectation = TimesCalledExpectation.new(double)
|
14
|
-
end
|
15
8
|
|
16
9
|
describe "#verify!" do
|
17
10
|
it "always passes" do
|
18
|
-
|
19
|
-
|
20
|
-
expectation.verify!
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "#attempt?" do
|
25
|
-
it "always returns true" do
|
26
|
-
expectation.should be_attempt
|
27
|
-
10.times {expectation.attempt}
|
28
|
-
expectation.should be_attempt
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "#attempt!" do
|
33
|
-
it "always passes" do
|
34
|
-
10.times {expectation.attempt}
|
35
|
-
end
|
36
|
-
end
|
11
|
+
stub(subject).foobar.any_number_of_times
|
12
|
+
RR.verify
|
37
13
|
|
38
|
-
|
39
|
-
|
40
|
-
|
14
|
+
stub(subject).foobar.any_number_of_times
|
15
|
+
10.times {subject.foobar}
|
16
|
+
RR.verify
|
41
17
|
end
|
42
18
|
end
|
43
19
|
end
|
data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_least_spec.rb
CHANGED
@@ -5,64 +5,32 @@ module RR
|
|
5
5
|
describe TimesCalledExpectation do
|
6
6
|
context "when using an AtLeastMatcher" do
|
7
7
|
it_should_behave_like "RR::Expectations::TimesCalledExpectation"
|
8
|
-
attr_reader :times, :at_least, :expectation
|
9
8
|
|
10
9
|
before do
|
11
|
-
|
12
|
-
double.definition.at_least(times)
|
13
|
-
@at_least = double.definition.times_matcher
|
14
|
-
@expectation = TimesCalledExpectation.new(double)
|
10
|
+
mock(subject).foobar.at_least(3)
|
15
11
|
end
|
16
12
|
|
17
13
|
describe "#verify!" do
|
18
14
|
it "passes when times called > times" do
|
19
|
-
4.times {
|
20
|
-
|
15
|
+
4.times {subject.foobar}
|
16
|
+
RR.verify
|
21
17
|
end
|
22
18
|
|
23
19
|
it "passes when times called == times" do
|
24
|
-
3.times {
|
25
|
-
|
20
|
+
3.times {subject.foobar}
|
21
|
+
RR.verify
|
26
22
|
end
|
27
23
|
|
28
24
|
it "raises error when times called < times" do
|
29
|
-
|
25
|
+
subject.foobar
|
30
26
|
lambda do
|
31
|
-
|
27
|
+
RR.verify
|
32
28
|
end.should raise_error(
|
33
29
|
RR::Errors::TimesCalledError,
|
34
30
|
"foobar()\nCalled 1 time.\nExpected at least 3 times."
|
35
31
|
)
|
36
32
|
end
|
37
33
|
end
|
38
|
-
|
39
|
-
describe "#attempt?" do
|
40
|
-
it "always returns true" do
|
41
|
-
expectation.should be_attempt
|
42
|
-
10.times {expectation.attempt}
|
43
|
-
expectation.should be_attempt
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "#attempt!" do
|
48
|
-
it "passes when times called more than times" do
|
49
|
-
4.times {expectation.attempt}
|
50
|
-
end
|
51
|
-
|
52
|
-
it "passes when times called == times" do
|
53
|
-
3.times {expectation.attempt}
|
54
|
-
end
|
55
|
-
|
56
|
-
it "passes when times called < times" do
|
57
|
-
expectation.attempt
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe "#terminal?" do
|
62
|
-
it "returns false" do
|
63
|
-
expectation.should_not be_terminal
|
64
|
-
end
|
65
|
-
end
|
66
34
|
end
|
67
35
|
end
|
68
36
|
end
|
@@ -5,64 +5,36 @@ module RR
|
|
5
5
|
describe TimesCalledExpectation do
|
6
6
|
context "when using an AtMostMatcher" do
|
7
7
|
it_should_behave_like "RR::Expectations::TimesCalledExpectation"
|
8
|
-
attr_reader :times, :at_most, :expectation
|
9
8
|
|
10
9
|
before do
|
11
|
-
|
12
|
-
double.definition.at_most(times)
|
13
|
-
@at_most = double.definition.times_matcher
|
14
|
-
@expectation = TimesCalledExpectation.new(double)
|
10
|
+
stub(subject).foobar.at_most(3)
|
15
11
|
end
|
16
12
|
|
17
13
|
describe "#verify!" do
|
18
|
-
it "returns true when times called == times" do
|
19
|
-
3.times {expectation.attempt}
|
20
|
-
expectation.verify!
|
21
|
-
end
|
22
|
-
|
23
|
-
it "raises error when times called < times" do
|
24
|
-
2.times {expectation.attempt}
|
25
|
-
expectation.verify!
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "#attempt?" do
|
30
|
-
it "returns true when attempted less than expected times" do
|
31
|
-
2.times {expectation.attempt}
|
32
|
-
expectation.should be_attempt
|
33
|
-
end
|
34
|
-
|
35
|
-
it "returns false when attempted expected times" do
|
36
|
-
3.times {expectation.attempt}
|
37
|
-
expectation.should_not be_attempt
|
38
|
-
end
|
39
|
-
|
40
|
-
it "raises error before attempted more than expected times" do
|
41
|
-
3.times {expectation.attempt}
|
42
|
-
lambda {expectation.attempt}.should raise_error( RR::Errors::TimesCalledError )
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "#attempt!" do
|
47
|
-
it "fails when times called more than times" do
|
48
|
-
3.times {expectation.attempt}
|
49
|
-
lambda do
|
50
|
-
expectation.attempt
|
51
|
-
end.should raise_error(RR::Errors::TimesCalledError, "foobar()\nCalled 4 times.\nExpected at most 3 times.")
|
52
|
-
end
|
53
|
-
|
54
14
|
it "passes when times called == times" do
|
55
|
-
3.times {
|
15
|
+
3.times {subject.foobar}
|
16
|
+
RR.verify
|
56
17
|
end
|
57
18
|
|
58
19
|
it "passes when times called < times" do
|
59
|
-
|
20
|
+
2.times {subject.foobar}
|
21
|
+
RR.verify
|
60
22
|
end
|
61
|
-
end
|
62
23
|
|
63
|
-
|
64
|
-
|
65
|
-
|
24
|
+
it "raises error when times called > times" do
|
25
|
+
lambda do
|
26
|
+
4.times {subject.foobar}
|
27
|
+
end.should raise_error(
|
28
|
+
RR::Errors::TimesCalledError,
|
29
|
+
"foobar()\nCalled 4 times.\nExpected at most 3 times."
|
30
|
+
)
|
31
|
+
|
32
|
+
lambda do
|
33
|
+
RR.verify
|
34
|
+
end.should raise_error(
|
35
|
+
RR::Errors::TimesCalledError,
|
36
|
+
"foobar()\nCalled 4 times.\nExpected at most 3 times."
|
37
|
+
)
|
66
38
|
end
|
67
39
|
end
|
68
40
|
end
|
@@ -1,18 +1,10 @@
|
|
1
1
|
module RR
|
2
2
|
module Expectations
|
3
3
|
describe TimesCalledExpectation, :shared => true do
|
4
|
-
attr_reader :subject
|
4
|
+
attr_reader :subject
|
5
5
|
it_should_behave_like "Swapped Space"
|
6
6
|
before do
|
7
7
|
@subject = Object.new
|
8
|
-
@method_name = :foobar
|
9
|
-
@double_injection = space.double_injection(subject, method_name)
|
10
|
-
@double_definition = RR::DoubleDefinitions::DoubleDefinition.new(
|
11
|
-
RR::DoubleDefinitions::DoubleDefinitionCreator.new,
|
12
|
-
subject
|
13
|
-
)
|
14
|
-
@double = new_double(double_injection)
|
15
|
-
double.definition.with_any_args.any_number_of_times
|
16
8
|
end
|
17
9
|
|
18
10
|
def raises_expectation_error(&block)
|
@@ -5,99 +5,53 @@ module RR
|
|
5
5
|
describe TimesCalledExpectation do
|
6
6
|
context "when using an IntegerMatcher" do
|
7
7
|
it_should_behave_like "RR::Expectations::TimesCalledExpectation"
|
8
|
-
attr_reader :matcher, :expected_line, :expectation
|
9
8
|
|
10
9
|
before do
|
11
|
-
|
12
|
-
@matcher = double.definition.times_matcher
|
13
|
-
@expectation = TimesCalledExpectation.new(double)
|
10
|
+
stub(subject).foobar.times(2)
|
14
11
|
end
|
15
12
|
|
16
|
-
describe "
|
17
|
-
it "returns true when times called exactly matches an integer" do
|
18
|
-
expectation.verify.should == false
|
19
|
-
expectation.attempt
|
20
|
-
expectation.verify.should == false
|
21
|
-
expectation.attempt
|
22
|
-
expectation.verify.should == true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "#verify! when passed an Integer (2)" do
|
13
|
+
describe "verify" do
|
27
14
|
it "passes after attempt! called 2 times" do
|
28
|
-
|
29
|
-
|
30
|
-
|
15
|
+
subject.foobar
|
16
|
+
subject.foobar
|
17
|
+
RR.verify
|
31
18
|
end
|
32
19
|
|
33
20
|
it "fails after attempt! called 1 time" do
|
34
|
-
|
35
|
-
lambda {
|
36
|
-
|
37
|
-
|
21
|
+
subject.foobar
|
22
|
+
lambda {RR.verify}.should raise_error(
|
23
|
+
RR::Errors::TimesCalledError,
|
24
|
+
"foobar()\nCalled 1 time.\nExpected 2 times."
|
38
25
|
)
|
39
26
|
end
|
40
27
|
|
41
28
|
it "can't be called when attempt! is called 3 times" do
|
42
|
-
|
43
|
-
|
29
|
+
subject.foobar
|
30
|
+
subject.foobar
|
31
|
+
lambda do
|
32
|
+
subject.foobar
|
33
|
+
end.should raise_error(RR::Errors::TimesCalledError, "foobar()\nCalled 3 times.\nExpected 2 times.")
|
44
34
|
lambda do
|
45
|
-
|
35
|
+
RR.verify
|
46
36
|
end.should raise_error(RR::Errors::TimesCalledError, "foobar()\nCalled 3 times.\nExpected 2 times.")
|
47
37
|
end
|
48
38
|
|
49
39
|
it "has a backtrace to where the TimesCalledExpectation was instantiated on failure" do
|
50
40
|
error = nil
|
51
41
|
begin
|
52
|
-
|
42
|
+
RR.verify
|
53
43
|
rescue RR::Errors::TimesCalledError => e
|
54
44
|
error = e
|
55
45
|
end
|
56
|
-
e.backtrace.
|
57
|
-
e.backtrace.first.should include(":#{expected_line}")
|
46
|
+
e.backtrace.join("\n").should include(__FILE__)
|
58
47
|
end
|
59
48
|
|
60
49
|
it "has an error message that includes the number of times called and expected number of times" do
|
61
50
|
lambda do
|
62
|
-
|
51
|
+
RR.verify
|
63
52
|
end.should raise_error(RR::Errors::TimesCalledError, "foobar()\nCalled 0 times.\nExpected 2 times.")
|
64
53
|
end
|
65
54
|
end
|
66
|
-
|
67
|
-
describe "#attempt?" do
|
68
|
-
it "returns true when attempted less than expected times" do
|
69
|
-
1.times {expectation.attempt}
|
70
|
-
expectation.should be_attempt
|
71
|
-
end
|
72
|
-
|
73
|
-
it "returns false when attempted expected times" do
|
74
|
-
2.times {expectation.attempt}
|
75
|
-
expectation.should_not be_attempt
|
76
|
-
end
|
77
|
-
|
78
|
-
it "raises error before attempted more than expected times" do
|
79
|
-
2.times {expectation.attempt}
|
80
|
-
lambda {expectation.attempt}.should raise_error(
|
81
|
-
RR::Errors::TimesCalledError
|
82
|
-
)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe "#attempt! for an IntegerMatcher" do
|
87
|
-
it "raises error when attempt! called more than the expected number of times" do
|
88
|
-
expectation.attempt
|
89
|
-
expectation.attempt
|
90
|
-
lambda do
|
91
|
-
expectation.attempt
|
92
|
-
end.should raise_error(RR::Errors::TimesCalledError)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe "#terminal?" do
|
97
|
-
it "returns true" do
|
98
|
-
expectation.should be_terminal
|
99
|
-
end
|
100
|
-
end
|
101
55
|
end
|
102
56
|
end
|
103
57
|
end
|
@@ -5,74 +5,28 @@ module RR
|
|
5
5
|
describe TimesCalledExpectation do
|
6
6
|
context "when using a ProcMatcher" do
|
7
7
|
it_should_behave_like "RR::Expectations::TimesCalledExpectation"
|
8
|
-
attr_reader :matcher, :expectation
|
9
8
|
|
10
9
|
before do
|
11
|
-
|
12
|
-
@matcher = double.definition.times_matcher
|
13
|
-
@expectation = TimesCalledExpectation.new(double)
|
10
|
+
stub(subject).foobar.times(lambda {|value| value == 2})
|
14
11
|
end
|
15
12
|
|
16
13
|
describe "#verify" do
|
17
|
-
it "matches a block" do
|
18
|
-
expectation.verify.should == false
|
19
|
-
expectation.attempt
|
20
|
-
expectation.verify.should == false
|
21
|
-
expectation.attempt
|
22
|
-
expectation.verify.should == true
|
23
|
-
expectation.attempt
|
24
|
-
expectation.verify.should == false
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "#verify! when passed a block (== 2 times)" do
|
29
14
|
it "passes after attempt! called 2 times" do
|
30
|
-
|
31
|
-
|
32
|
-
|
15
|
+
subject.foobar
|
16
|
+
subject.foobar
|
17
|
+
RR.verify
|
33
18
|
end
|
34
19
|
|
35
20
|
it "fails after attempt! called 1 time" do
|
36
|
-
|
37
|
-
lambda {
|
21
|
+
subject.foobar
|
22
|
+
lambda {RR.verify}.should raise_error(RR::Errors::TimesCalledError)
|
38
23
|
end
|
39
24
|
|
40
25
|
it "fails after attempt! called 3 times" do
|
41
|
-
expectation.attempt
|
42
|
-
expectation.attempt
|
43
|
-
expectation.attempt
|
44
|
-
lambda {expectation.verify!}.should raise_error(RR::Errors::TimesCalledError)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "#attempt? with IntegerMatcher" do
|
49
|
-
it "returns true when attempted less than expected times" do
|
50
|
-
1.times {expectation.attempt}
|
51
|
-
expectation.should be_attempt
|
52
|
-
end
|
53
|
-
|
54
|
-
it "returns true when attempted expected times" do
|
55
|
-
2.times {expectation.attempt}
|
56
|
-
expectation.should be_attempt
|
57
|
-
end
|
58
|
-
|
59
|
-
it "returns true when attempted more than expected times" do
|
60
|
-
3.times {expectation.attempt}
|
61
|
-
expectation.should be_attempt
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "#attempt! for a lambda expectation" do
|
66
|
-
it "lets everything pass" do
|
67
26
|
subject.foobar
|
68
27
|
subject.foobar
|
69
28
|
subject.foobar
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
describe "#terminal? with ProcMatcher" do
|
74
|
-
it "returns false" do
|
75
|
-
expectation.should_not be_terminal
|
29
|
+
lambda {RR.verify}.should raise_error(RR::Errors::TimesCalledError)
|
76
30
|
end
|
77
31
|
end
|
78
32
|
end
|
@@ -5,76 +5,32 @@ module RR
|
|
5
5
|
describe TimesCalledExpectation do
|
6
6
|
context "when using a RangeMatcher" do
|
7
7
|
it_should_behave_like "RR::Expectations::TimesCalledExpectation"
|
8
|
-
attr_reader :matcher, :expectation
|
9
8
|
|
10
9
|
before do
|
11
|
-
|
12
|
-
@matcher = double.definition.times_matcher
|
13
|
-
@expectation = TimesCalledExpectation.new(double)
|
10
|
+
stub(subject).foobar.times(1..2)
|
14
11
|
end
|
15
12
|
|
16
13
|
describe "#verify" do
|
17
|
-
it "returns true when times called falls within a range" do
|
18
|
-
expectation.verify.should == false
|
19
|
-
expectation.attempt
|
20
|
-
expectation.verify.should == true
|
21
|
-
expectation.attempt
|
22
|
-
expectation.verify.should == true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "#verify! when passed a Range (1..2)" do
|
27
14
|
it "passes after attempt! called 1 time" do
|
28
|
-
|
29
|
-
|
15
|
+
subject.foobar
|
16
|
+
RR.verify
|
30
17
|
end
|
31
18
|
|
32
19
|
it "passes after attempt! called 2 times" do
|
33
|
-
|
34
|
-
|
35
|
-
|
20
|
+
subject.foobar
|
21
|
+
subject.foobar
|
22
|
+
RR.verify
|
36
23
|
end
|
37
24
|
|
38
25
|
it "can't be called when attempt! is called 3 times" do
|
39
|
-
|
40
|
-
|
26
|
+
subject.foobar
|
27
|
+
subject.foobar
|
41
28
|
lambda do
|
42
|
-
|
29
|
+
subject.foobar
|
30
|
+
end.should raise_error(RR::Errors::TimesCalledError, "foobar()\nCalled 3 times.\nExpected 1..2 times.")
|
31
|
+
lambda do
|
32
|
+
RR.verify
|
43
33
|
end.should raise_error(RR::Errors::TimesCalledError, "foobar()\nCalled 3 times.\nExpected 1..2 times.")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "#attempt? with RangeMatcher" do
|
48
|
-
it "returns true when attempted less than low end of range" do
|
49
|
-
expectation.should be_attempt
|
50
|
-
end
|
51
|
-
|
52
|
-
it "returns false when attempted in range" do
|
53
|
-
expectation.attempt
|
54
|
-
expectation.should be_attempt
|
55
|
-
expectation.attempt
|
56
|
-
expectation.should be_attempt
|
57
|
-
end
|
58
|
-
|
59
|
-
it "raises error before attempted more than expected times" do
|
60
|
-
2.times {expectation.attempt}
|
61
|
-
lambda {expectation.attempt}.should raise_error(
|
62
|
-
RR::Errors::TimesCalledError
|
63
|
-
)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe "#attempt! for a range expectation" do
|
68
|
-
it "raises error when attempt! called more than range permits" do
|
69
|
-
expectation.attempt
|
70
|
-
expectation.attempt
|
71
|
-
raises_expectation_error {expectation.attempt}
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe "#terminal? with RangeMatcher" do
|
76
|
-
it "returns true" do
|
77
|
-
expectation.should be_terminal
|
78
34
|
end
|
79
35
|
end
|
80
36
|
end
|