Skip to content

Commit

Permalink
Ensure bower executable exists on $PATH
Browse files Browse the repository at this point in the history
Adds coverage for missing `bower` executable.

To deal with a missing `bower` executable, ensure the `path` is not
`nil` before turning into a `Pathname`.
  • Loading branch information
krishandley authored and seanpdoyle committed Jan 21, 2016
1 parent f510fe8 commit ce5db79
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ember_cli/path_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def bower
bower_path = app_options.fetch(:bower_path) { which("bower") }

bower_path.tap do |path|
unless Pathname(path).executable?
unless Pathname(path.to_s).executable?
fail DependencyError.new <<-MSG.strip_heredoc
Bower is required by EmberCLI
Expand Down
11 changes: 11 additions & 0 deletions spec/lib/ember_cli/path_set_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@

expect(path_set.bower).to eq fake_bower
end

context "when it is missing from the $PATH" do
it "raises a helpful exception" do
stub_which(bower: nil)

path_set = build_path_set

expect { path_set.bower }.
to raise_error(EmberCli::DependencyError, /bower is required/i)
end
end
end

describe "#npm" do
Expand Down

0 comments on commit ce5db79

Please sign in to comment.