Refactored tests to use given_castle and fewer mocks.
This commit is contained in:
@@ -7,17 +7,17 @@ describe "homesick" do
|
|||||||
context "of a file" do
|
context "of a file" do
|
||||||
it "should symlink existing directories" do
|
it "should symlink existing directories" do
|
||||||
somewhere = create_construct
|
somewhere = create_construct
|
||||||
somewhere.directory('wtf')
|
local_repo = somewhere.directory('wtf')
|
||||||
wtf = somewhere + 'wtf'
|
|
||||||
|
|
||||||
homesick.should_receive(:ln_s).with(wtf, wtf.basename)
|
homesick.clone local_repo
|
||||||
|
|
||||||
homesick.clone wtf
|
@repos_dir.join("wtf").readlink.should == local_repo
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when it exists in a repo directory" do
|
context "when it exists in a repo directory" do
|
||||||
before do
|
before do
|
||||||
@existing_dir = @repos_dir.directory('existing_castle')
|
@existing_castle = given_castle("existing_castle")
|
||||||
|
@existing_dir = @existing_castle.parent
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should not symlink" do
|
it "should not symlink" do
|
||||||
@@ -27,10 +27,7 @@ describe "homesick" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should raise an error" do
|
it "should raise an error" do
|
||||||
@existing_castle = homesick.send(:repos_dir) + 'existing_castle'
|
expect { homesick.clone @existing_dir.to_s }.to raise_error(/already cloned/i)
|
||||||
lambda {
|
|
||||||
homesick.clone @existing_castle.to_s
|
|
||||||
}.should raise_error(/already cloned/i)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -72,9 +69,7 @@ describe "homesick" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should throw an exception when trying to clone a malformed uri like malformed" do
|
it "should throw an exception when trying to clone a malformed uri like malformed" do
|
||||||
lambda {
|
expect { homesick.clone 'malformed' }.to raise_error
|
||||||
homesick.clone 'malformed'
|
|
||||||
}.should raise_error
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should clone a github repo" do
|
it "should clone a github repo" do
|
||||||
|
|||||||
Reference in New Issue
Block a user