Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
refactor node_spec to test 0.6, 0.8, and 0.10
  • Loading branch information
Dmitriy Kalinin and Max Brunsfeld committed Mar 28, 2013
1 parent ea76369 commit d98373d
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 30 deletions.
2 changes: 1 addition & 1 deletion assets
26 changes: 16 additions & 10 deletions config/assets.yml
Expand Up @@ -73,6 +73,22 @@ rails3:
path: "assets/ruby/rails3"
command: "bundle exec rake db:migrate --trace && bundle exec rails server thin -p $PORT"

# Node apps:
node0_6:
memory: 512
path: "assets/node/node0_6"
command: "node app.js"

node0_8:
memory: 512
path: "assets/node/node0_8"
command: "node app.js"

node0_10:
memory: 512
path: "assets/node/node0_10"
command: "node app.js"

# Lifecycle apps:
basic:
memory: 512
Expand Down Expand Up @@ -229,16 +245,6 @@ app_node_service:
path: "assets/node/app_node_service"
command: "node main.js"

app_node_dependencies06:
memory: 512
path: "assets/node/node_dependencies06"
command: "node app.js"

app_node_dependencies08:
memory: 512
path: "assets/node/node_dependencies08"
command: "node app.js"

app_node_version04:
memory: 512
path: "assets/node/app_node_version"
Expand Down
56 changes: 37 additions & 19 deletions spec/apps/node_spec.rb
Expand Up @@ -5,31 +5,49 @@
describe "Node" do
before(:all) { @session = BVT::Harness::CFSession.new }

after(:each) do
@session.cleanup!
end
def self.it_supports_basics(version, opts={})
it "starts the app successfully" do
res = app.get_response(:get, "/node_version")
res.to_str.should start_with("v#{version}.")
end

it "supports git modules" do
# The only to make sure that semver came from git (via npm)
# is to check npm's _git-remotes internal dir.
# (Older npm versions do not create _git-remotes)
if opts[:skip_git_remotes]
package_json = app.file("app/package.json")
package_json.should include %q{"semver": "git://github.com}
else
files = app.files("app/.npm/_git-remotes").flatten
files.should include "git-github-com-isaacs-node-semver-git-6952f3ca/"
end

res = app.get_response(:get, "/git_module")
res.to_str.should == "ok"
end

it "supports native extensions via node-gyp" do
log = app.file("logs/staging_task.log")
log.should include "CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o"

it "access my application root and see it's running version" do
app = create_push_app("app_node_version04")
app.stats.should_not == nil
app.get_response(:get).to_str.should =~ /running version/
res = app.get_response(:get, "/native_ext")
res.to_str.should == "ok"
end
end

it "access my application root and see hello from git" do
app = create_push_app("node_git_modules")
app.stats.should_not == nil
app.get_response(:get).to_str.should == "hello from git"
describe "node 0.6" do
with_app "node0_6"
it_supports_basics "0.6", :skip_git_remotes => true
end

it "access my application root and see hello from express" do
app = create_push_app("app_node_dependencies06")
app.stats.should_not == nil
app.get_response(:get).to_str.should == "hello from express"
describe "node 0.8" do
with_app "node0_8"
it_supports_basics "0.8"
end

it "access my application root and see hello from node-gyp" do
app = create_push_app("app_node_dependencies08")
app.stats.should_not == nil
app.get_response(:get).to_str.should == "hello from node-gyp"
describe "node 0.10" do
with_app "node0_10"
it_supports_basics "0.10"
end
end

0 comments on commit d98373d

Please sign in to comment.