diff --git a/lib/guard.rb b/lib/guard.rb index 4dfcc1f..98187c9 100644 --- a/lib/guard.rb +++ b/lib/guard.rb @@ -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 diff --git a/spec/guard_spec.rb b/spec/guard_spec.rb index 2c468b5..b90adfb 100644 --- a/spec/guard_spec.rb +++ b/spec/guard_spec.rb @@ -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