Made specs for list pass, refactored track to use given_castle.
This commit is contained in:
@@ -116,7 +116,7 @@ class Homesick < Thor
|
|||||||
desc "list", "List cloned castles"
|
desc "list", "List cloned castles"
|
||||||
def list
|
def list
|
||||||
inside_each_castle do |castle|
|
inside_each_castle do |castle|
|
||||||
say_status castle.relative_path_from(repos_dir), `git config remote.origin.url`.chomp, :cyan
|
say_status castle.relative_path_from(repos_dir).to_s, `git config remote.origin.url`.chomp, :cyan
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -98,9 +98,7 @@ describe "homesick" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "list" do
|
describe "list" do
|
||||||
|
it "should say each castle in the castle directory" do
|
||||||
# FIXME only passes in isolation. need to setup data a bit better
|
|
||||||
xit "should say each castle in the castle directory" do
|
|
||||||
given_castle('zomg')
|
given_castle('zomg')
|
||||||
given_castle('zomg', 'wtf/zomg')
|
given_castle('zomg', 'wtf/zomg')
|
||||||
|
|
||||||
@@ -123,21 +121,16 @@ describe "homesick" do
|
|||||||
|
|
||||||
describe "track" do
|
describe "track" do
|
||||||
it "should move the tracked file into the castle" 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'
|
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')
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user