examples/rr/space/space_verify_example.rb in rr-0.2.5 vs examples/rr/space/space_verify_example.rb in rr-0.3.0
- old
+ new
@@ -10,22 +10,22 @@
@object2 = Object.new
@method_name = :foobar
end
it "verifies and deletes the doubles" do
- double1 = @space.create_double(@object1, @method_name)
+ double1 = @space.double(@object1, @method_name)
double1_verify_calls = 0
double1_reset_calls = 0
(class << double1; self; end).class_eval do
define_method(:verify) do ||
double1_verify_calls += 1
end
define_method(:reset) do ||
double1_reset_calls += 1
end
end
- double2 = @space.create_double(@object2, @method_name)
+ double2 = @space.double(@object2, @method_name)
double2_verify_calls = 0
double2_reset_calls = 0
(class << double2; self; end).class_eval do
define_method(:verify) do ||
double2_verify_calls += 1
@@ -51,11 +51,11 @@
@object = Object.new
@method_name = :foobar
end
it "verifies and deletes the double" do
- double = @space.create_double(@object, @method_name)
+ double = @space.double(@object, @method_name)
@space.doubles[@object][@method_name].should === double
@object.methods.should include("__rr__#{@method_name}")
verify_calls = 0
(class << double; self; end).class_eval do
@@ -69,11 +69,11 @@
@space.doubles[@object][@method_name].should be_nil
@object.methods.should_not include("__rr__#{@method_name}")
end
it "deletes the double when verifying the double raises an error" do
- double = @space.create_double(@object, @method_name)
+ double = @space.double(@object, @method_name)
@space.doubles[@object][@method_name].should === double
@object.methods.should include("__rr__#{@method_name}")
verify_called = true
(class << double; self; end).class_eval do
@@ -95,15 +95,15 @@
before do
@space = Space.new
@object = Object.new
@method_name = :foobar
- @double = @space.create_double(@object, @method_name)
+ @double = @space.double(@object, @method_name)
end
it "raises an error when Scenario is NonTerminal" do
- scenario = @space.create_scenario(@double)
+ scenario = @space.scenario(@double)
@space.register_ordered_scenario(scenario)
scenario.any_number_of_times
scenario.should_not be_terminal
@@ -118,22 +118,22 @@
describe Space, "#verify_ordered_scenario where the passed in scenario is at the front of the queue" do
it_should_behave_like "RR::Space#verify_ordered_scenario"
it "keeps the scenario when times called is not verified" do
- scenario = @space.create_scenario(@double)
+ scenario = @space.scenario(@double)
@space.register_ordered_scenario(scenario)
scenario.twice
scenario.should be_attempt
@space.verify_ordered_scenario(scenario)
@space.ordered_scenarios.should include(scenario)
end
it "removes the scenario when times called expectation should no longer be attempted" do
- scenario = @space.create_scenario(@double)
+ scenario = @space.scenario(@double)
@space.register_ordered_scenario(scenario)
scenario.with(1).once
@object.foobar(1)
scenario.should_not be_attempt
@@ -145,12 +145,12 @@
describe Space, "#verify_ordered_scenario where the passed in scenario is not at the front of the queue" do
it_should_behave_like "RR::Space#verify_ordered_scenario"
it "raises error" do
- first_scenario = create_scenario
- second_scenario = create_scenario
+ first_scenario = scenario
+ second_scenario = scenario
proc do
@space.verify_ordered_scenario(second_scenario)
end.should raise_error(
Errors::ScenarioOrderError,
@@ -158,11 +158,11 @@
"- foobar()\n" <<
"- foobar()"
)
end
- def create_scenario
- scenario = @space.create_scenario(@double).once
+ def scenario
+ scenario = @space.scenario(@double).once
@space.register_ordered_scenario(scenario)
scenario
end
end
end
\ No newline at end of file