refactor given_castle
This commit is contained in:
@@ -122,7 +122,7 @@ describe "homesick" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "with '.config' in .homesick_subdir" do
|
context "with '.config' in .homesick_subdir" do
|
||||||
let(:castle) { given_castle("glencairn", "glencairn", [".config"]) }
|
let(:castle) { given_castle("glencairn", [".config"]) }
|
||||||
it "can symlink in sub directory" do
|
it "can symlink in sub directory" do
|
||||||
dotdir = castle.directory(".config")
|
dotdir = castle.directory(".config")
|
||||||
dotfile = dotdir.file(".some_dotfile")
|
dotfile = dotdir.file(".some_dotfile")
|
||||||
@@ -136,7 +136,7 @@ describe "homesick" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "with '.config/appA' in .homesick_subdir" do
|
context "with '.config/appA' in .homesick_subdir" do
|
||||||
let(:castle) { given_castle("glencairn", "glencairn", [".config/appA"]) }
|
let(:castle) { given_castle("glencairn", [".config/appA"]) }
|
||||||
it "can symlink in nested sub directory" do
|
it "can symlink in nested sub directory" do
|
||||||
dotdir = castle.directory(".config").directory("appA")
|
dotdir = castle.directory(".config").directory("appA")
|
||||||
dotfile = dotdir.file(".some_dotfile")
|
dotfile = dotdir.file(".some_dotfile")
|
||||||
@@ -153,7 +153,7 @@ describe "homesick" do
|
|||||||
describe "list" do
|
describe "list" do
|
||||||
it "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')
|
||||||
given_castle('zomg', 'wtf/zomg')
|
given_castle('wtf/zomg')
|
||||||
|
|
||||||
homesick.should_receive(:say_status).with("zomg", "git://github.com/technicalpickles/zomg.git", :cyan)
|
homesick.should_receive(:say_status).with("zomg", "git://github.com/technicalpickles/zomg.git", :cyan)
|
||||||
homesick.should_receive(:say_status).with("wtf/zomg", "git://github.com/technicalpickles/zomg.git", :cyan)
|
homesick.should_receive(:say_status).with("wtf/zomg", "git://github.com/technicalpickles/zomg.git", :cyan)
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ RSpec.configure do |config|
|
|||||||
homesick.stub(:say_status)
|
homesick.stub(:say_status)
|
||||||
end
|
end
|
||||||
|
|
||||||
def given_castle(name, path=name, subdirs=[])
|
def given_castle(path, subdirs=[])
|
||||||
|
name = Pathname.new(path).basename
|
||||||
castles.directory(path) do |castle|
|
castles.directory(path) do |castle|
|
||||||
Dir.chdir(castle) do
|
Dir.chdir(castle) do
|
||||||
system "git init >/dev/null 2>&1"
|
system "git init >/dev/null 2>&1"
|
||||||
|
|||||||
Reference in New Issue
Block a user