0
@@ -2,17 +2,28 @@ require File.dirname(__FILE__) + "/../test_helper"
0
class TestLockUnlock < Test::Unit::TestCase
0
- @values = {:lock => "false", "handler" => { :repository => "repository" }}
0
+ @values = {"lock" => false}
0
@wc = mock("WorkingCopy")
0
+ def test_lock_working_copy
0
+ run_and_verify(true) do
0
@wc.expects(:exist?).returns(true)
0
@wc.expects(:pistonized?).returns(true)
0
@wc.expects(:recall).returns(@values)
0
@wc.expects(:finalize).returns(@values)
0
- @wc.expects(:remember).with(@values, @values["handler"]).returns(@values)
0
+ @wc.expects(:remember).with(@values.merge("lock" => true), @values["handler"]).returns(@values)
0
+ def test_unlock_working_copy
0
+ run_and_verify(false) do
0
+ @wc.expects(:exist?).returns(true)
0
+ @wc.expects(:pistonized?).returns(true)
0
+ @wc.expects(:recall).returns(@values)
0
+ @wc.expects(:finalize).returns(@values)
0
+ @wc.expects(:remember).with(@values.merge("lock" => false), @values["handler"]).returns(@values)
0
@@ -34,14 +45,14 @@ class TestLockUnlock < Test::Unit::TestCase
0
+ def run_and_verify(lock=true)
0
+ lock_unlock_command.run(@wcdir, lock)
0
- Piston::WorkingCopy.expects(:guess).with("directory").returns(@wc)
0
- Piston::Commands::LockUnlock.new(:wcdir => "directory", :verbose => "verbose",
0
+ def lock_unlock_command
0
+ Piston::WorkingCopy.expects(:guess).with(@wcdir).returns(@wc)
0
+ Piston::Commands::LockUnlock.new(:verbose => "verbose",
0
:quiet => "quiet", :force => "force")
Comments
No one has commented yet.