-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
node_spec.rb
41 lines (35 loc) · 1.37 KB
/
node_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require 'spec_helper'
describe "Node" do
it "works with node buildpack" do
before_deploy = Proc.new do
run!("rm .buildpacks")
run!("echo https://github.com/heroku/heroku-buildpack-nodejs.git >> .buildpacks")
run!("echo #{Hatchet::App.default_buildpack} >> .buildpacks")
end
Hatchet::Runner.new(
"node_multi",
before_deploy: before_deploy,
buildpack_url: "https://github.com/heroku/heroku-buildpack-multi.git"
).deploy do |app|
expect(app.output).to match("Node Version in Ruby buildpack is: v4.1.2")
expect(app.run("node -v")).to match("v4.1.2")
end
end
it "node is installed by default without multi buildpack" do
default_node_version = LanguagePack::Helpers::NodeInstaller.new.version
Hatchet::Runner.new("node_multi").deploy do |app|
expect(app.output).to match("Node Version in Ruby buildpack is: v#{default_node_version}")
expect(app.run("node -v")).to match(default_node_version)
end
end
it "doesn't install node without execjs or webpacker" do
Hatchet::Runner.new("default_ruby").deploy do |app|
expect(app.run("node -v")).to match("node: command not found")
end
end
it "installs node when webpacker is detected but no execjs" do
Hatchet::Runner.new("webpacker_no_execjs").deploy do |app|
expect(app.output).to match("Installing node-v")
end
end
end