locate_guard chomp newline at end of path

This commit is contained in:
Yann Lugrin 2010-10-23 18:43:51 +08:00 committed by Thibaud Guillaume-Gentil
parent 5371f467ff
commit 3cdcea3dfd
2 changed files with 4 additions and 2 deletions

View File

@ -55,7 +55,7 @@ module Guard
end
def locate_guard(name)
`gem open guard-#{name} --latest --command echo`
`gem open guard-#{name} --latest --command echo`.chomp
rescue
UI.error "Could not find 'guard-#{name}' gem path."
end

View File

@ -13,7 +13,9 @@ describe Guard do
describe "locate_guard" do
it "should return guard-rspec gem path" do
Guard.locate_guard('rspec').should match(/^.*\/guard-rspec-.*$/)
guard_path = Guard.locate_guard('rspec')
guard_path.should match(/^.*\/guard-rspec-.*$/)
guard_path.should == guard_path.chomp
end
end