Made specs for list pass, refactored track to use given_castle.

This commit is contained in:
Jacob Buys
2011-08-21 22:04:57 +02:00
parent 4d9f75b7b0
commit 4fa7ce416b
2 changed files with 10 additions and 17 deletions

View File

@@ -98,9 +98,7 @@ describe "homesick" do
end
describe "list" do
# FIXME only passes in isolation. need to setup data a bit better
xit "should say each castle in the castle directory" do
it "should say each castle in the castle directory" do
given_castle('zomg')
given_castle('zomg', 'wtf/zomg')
@@ -123,21 +121,16 @@ describe "homesick" do
describe "track" do
it "should move the tracked file into the castle" do
castle = given_castle('castle_repo')
some_rc_file = @user_dir.file '.some_rc_file'
homesickrepo = @user_dir.directory('.homesick').directory('repos').directory('castle_repo')
castle_path = homesickrepo.directory 'home'
# There is some hideous thing going on with construct; rming the file I'm moving works on this test.
# Otherwise when track ln_s's it back out, it sees a conflict. Its as if file operations don't
# actually effect this thing, or something.
system "rm #{some_rc_file.to_s}"
Dir.chdir homesickrepo do
system "git init >/dev/null 2>&1"
end
homesick.should_receive(:mv).with(some_rc_file, castle_path)
homesick.should_receive(:ln_s).with(castle_path + some_rc_file.basename, some_rc_file)
homesick.track(some_rc_file.to_s, 'castle_repo')
tracked_file = castle.join(".some_rc_file")
tracked_file.should exist
some_rc_file.readlink.should == tracked_file
end
end
end