From 3cdcea3dfdd8a8b57b6644790b371c0733e202c9 Mon Sep 17 00:00:00 2001 From: Yann Lugrin Date: Sat, 23 Oct 2010 18:43:51 +0800 Subject: [PATCH] locate_guard chomp newline at end of path --- lib/guard.rb | 2 +- spec/guard_spec.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) 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