Skip to content

Instantly share code, notes, and snippets.

@dchelimsky
Created February 2, 2009 21:55
Show Gist options
  • Save dchelimsky/57127 to your computer and use it in GitHub Desktop.
Save dchelimsky/57127 to your computer and use it in GitHub Desktop.
# Sets up the Merb environment for Cucumber (thanks to krzys and roman)
require "rubygems"
# Add the local gems dir if found within the app root; any dependencies loaded
# hereafter will try to load from the local gems before loading system gems.
if (local_gem_dir = File.join(File.dirname(__FILE__), '..', 'gems')) && $BUNDLE.nil?
$BUNDLE = true; Gem.clear_paths; Gem.path.unshift(local_gem_dir)
end
require "merb-core"
require "spec"
require "merb_cucumber/world/simple"
require "merb_cucumber/helpers/activerecord"
# Hack to get webrat not complain about ActionController::IntegrationTest
module ActionController
class IntegrationTest
end
end
# Hack to get webrat to play nice with Merb
RAILS_ROOT = File.join(File.dirname(__FILE__), "/../..")
require "webrat/selenium"
Webrat.configure do |config|
config.mode = :selenium
end
World do |world|
world.extend Webrat::Methods
world.extend Webrat::Selenium::Methods
world.extend Webrat::Selenium::Matchers
end
Merb.start_environment(:testing => true, :adapter => 'runner', :environment => ENV['MERB_ENV'] || 'test')
When I create a content type named "Page" # features/step_definitions/content_types.rb:5
execution expired (Timeout::Error)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:54:in `wait_for_service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:56:in `timeout'
./features/support/env.rb:34:in `start_app_server'
(eval):2:in `visit'
./features/step_definitions/content_types.rb:6:in `/^I create a content type named "Page"$/'
features/content_types/create_content_type.feature:9:in `When I create a content type named "Page"'
$ bin/cucumber -r features features
Feature: create a content type
As a site developer
I want to create a content type
So that I can begin to create content
Scenario: create a content type # features/content_types/create_content_type.feature:7
Given there are no content types # features/step_definitions/content_types.rb:1
16:01:19.927 WARN - Failed to start: [email protected]:4444
Exception in thread "main" org.mortbay.util.MultiException[java.net.BindException: Address already in use]
at org.mortbay.http.HttpServer.doStart(HttpServer.java:686)
at org.mortbay.util.Container.start(Container.java:72)
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:389)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:220)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:186)
java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at org.mortbay.util.ThreadedServer.newServerSocket(ThreadedServer.java:391)
at org.mortbay.util.ThreadedServer.open(ThreadedServer.java:477)
at org.mortbay.util.ThreadedServer.start(ThreadedServer.java:503)
at org.mortbay.http.SocketListener.start(SocketListener.java:203)
at org.mortbay.http.HttpServer.doStart(HttpServer.java:716)
at org.mortbay.util.Container.start(Container.java:72)
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:389)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:220)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:186)
When I create a content type named "Page" # features/step_definitions/content_types.rb:5
execution expired (Timeout::Error)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:54:in `wait_for_service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:56:in `timeout'
(eval):2:in `visit'
./features/step_definitions/content_types.rb:6:in `/^I create a content type named "Page"$/'
features/content_types/create_content_type.feature:9:in `When I create a content type named "Page"'
Then I should see "Page" in the list of content types # features/step_definitions/content_types.rb:9
1 scenario
1 failed step
1 skipped step
1 passed step
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment