Skip to content

Commit

Permalink
Yeah, that's better
Browse files Browse the repository at this point in the history
  • Loading branch information
nevir committed Mar 3, 2013
1 parent e89d252 commit 88d984d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/cli_forge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def self.guess_bin_name

def self.caller_path(stack_line)
return unless stack_line
stack_path = stack_line.split.first
stack_path = stack_line.split(":").first
return if stack_path =~ /^\(.*\)$/

File.expand_path(File.dirname(stack_path))
end
Expand Down
6 changes: 6 additions & 0 deletions spec/unit/cli_forge/class_methods/caller_path_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@ def spec_caller_line
expect(path).to eq(nil)
end

it "should not expose fake paths as the current path" do
path = described_class.caller_path("(irb):3:in `irb_binding'")

expect(path).to eq(nil)
end

end

0 comments on commit 88d984d

Please sign in to comment.