diff options
| author | Christian Moritz | 2017-06-26 21:47:47 +0200 |
|---|---|---|
| committer | Christian Moritz | 2017-06-29 20:29:25 +0200 |
| commit | 6baea2543aef21d996f04a3eff96185c4a6feba1 (patch) | |
| tree | 16f13442c6266e1ec1bc94b40e9f10ec5a1d4e61 /Library/Homebrew/test/language/node_spec.rb | |
| parent | 466fe9841a9af915fe78c1fd8648a745610f942d (diff) | |
| download | brew-6baea2543aef21d996f04a3eff96185c4a6feba1.tar.bz2 | |
language/node: set cache config via argument
instead of writing a .npmrc file, which simplifies the code.
npm_cache_config is still preserved for backwarts compatiblility and
usage int he kibana@n formulas in core.
Diffstat (limited to 'Library/Homebrew/test/language/node_spec.rb')
| -rw-r--r-- | Library/Homebrew/test/language/node_spec.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Library/Homebrew/test/language/node_spec.rb b/Library/Homebrew/test/language/node_spec.rb index e4ed9ee1f..a8f95fe9a 100644 --- a/Library/Homebrew/test/language/node_spec.rb +++ b/Library/Homebrew/test/language/node_spec.rb @@ -2,22 +2,21 @@ require "language/node" describe Language::Node do describe "#setup_npm_environment" do - it "does nothing when npmrc exists" do - expect(subject.setup_npm_environment).to be_nil - end - - it "calls prepend_path when node formula exists and npmrc does not exist" do + it "calls prepend_path when node formula exists only during the first call" do node = formula "node" do url "node-test" end stub_formula_loader(node) - allow_any_instance_of(Pathname).to receive(:exist?).and_return(false) expect(ENV).to receive(:prepend_path) - subject.setup_npm_environment + subject.instance_variable_set(:@env_set, false) + expect(subject.setup_npm_environment).to be_nil + + expect(subject.instance_variable_get(:@env_set)).to eq(true) + expect(ENV).not_to receive(:prepend_path) + expect(subject.setup_npm_environment).to be_nil end - it "does not call prepend_path when node formula does not exist but npmrc exists" do - allow_any_instance_of(Pathname).to receive(:exist?).and_return(false) + it "does not call prepend_path when node formula does not exist" do expect(subject.setup_npm_environment).to be_nil end end @@ -51,6 +50,6 @@ describe Language::Node do specify "#local_npm_install_args" do resp = subject.local_npm_install_args - expect(resp).to include("-ddd", "--build-from-source") + expect(resp).to include("-ddd", "--build-from-source", "--cache=#{HOMEBREW_CACHE}/npm_cache") end end |
