Run cucumber through spork - ruby-on-rails

I have the Exception encountered: #<SystemExit: exit> error, when trying run cucumber through spork.
features/support/env.rb:
require 'rubygems'
require 'spork'
require 'cucumber/rails'
require 'pickle/world'
require "capybara/poltergeist"
Spork.prefork do
Capybara.javascript_driver = :poltergeist
end
Spork.each_run do
ActionController::Base.allow_rescue = false
begin
DatabaseCleaner[:mongoid].strategy = :truncation
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
DatabaseCleaner[:mongoid].clean
Cucumber::Rails::Database.javascript_strategy = :truncation
end
Run without spork:
vagrant#lucid32:/vagrant$ bundle exec cucumber
WARNING: No DRb server is running. Running features locally:
Rack::File headers parameter replaces cache_control after Rack 1.5.
Using the default profile...
Feature: Password recovery
In order to retrieve lost password
As a user of this site
I want to reset it
Scenario: Reset password # features/users/password_recovery.feature:6
Given I am not logged in # features/step_definitions/login_steps.rb:1
And a user exists # features/step_definitions/pickle_steps.rb:4
1 scenario (1 passed)
2 steps (2 passed)
0m0.504s
Run with spork:
vagrant#lucid32:/vagrant$ bundle exec cucumber
Disabling profiles...
Feature: Password recovery
In order to retrieve lost password
As a user of this site
I want to reset it
Scenario: Reset password # features/users/password_recovery.feature:6
Given I am not logged in # features/step_definitions/login_steps.rb:1
And a user exists # features/step_definitions/pickle_steps.rb:4
1 scenario (1 passed)
2 steps (2 passed)
0m0.495s
Exception encountered: #<SystemExit: exit>
backtrace:
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/cucumber-1.3.1/lib/cucumber/cli/main.rb:54:in `exit'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/cucumber-1.3.1/lib/cucumber/cli/main.rb:54:in `rescue in execute!'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/cucumber-1.3.1/lib/cucumber/cli/main.rb:37:in `execute!'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-0.9.2/lib/spork/test_framework/cucumber.rb:24:in `run_tests'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:13:in `block in run'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-0.9.2/lib/spork/forker.rb:21:in `block in initialize'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-0.9.2/lib/spork/forker.rb:18:in `fork'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-0.9.2/lib/spork/forker.rb:18:in `initialize'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:9:in `new'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:9:in `run'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-0.9.2/lib/spork/server.rb:48:in `run'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
/usr/local/rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
How to solve it?

I also encountered this. Not sure why, but I guess this is because I'd updated cucumber-rails to the latest version. After I switched back to older version, the problem's gone
try putting these lines into your Gemfile
gem 'cucumber', '1.2.5'
gem 'cucumber-rails', '1.3.0', :require => false
then bundle install
I hope this helps

I submitted a pull request to spork to fix the issue.
https://github.com/sporkrb/spork/pull/228

Related

Testing a databaseless Rails 5 application with rspec-rails

I have a Rails 5.0.1 app that is NOT backed by any database. When attempting to write a controller test I get a ActiveRecord::ConnectionNotEstablished exception even though I have explicitly configured my spec/rails_helper.rb not to use ActiveRecord and removed references to active_record in config/application.rb. RSpec is trying to run such test within a transaction which requires a database connection to be established. I am attaching the stack trace for reference and I used this Github issue to setup RSpec without ActiveRecord rspec-rails for a rails project without db connection.
Failures:
1) ApplicationController the truth false not equal true
Failure/Error: raise ConnectionNotEstablished, "No connection pool with id #{spec_name} found." unless pool
ActiveRecord::ConnectionNotEstablished:
No connection pool with id primary found.
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `retrieve_connection'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_handling.rb:128:in `retrieve_connection'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_handling.rb:91:in `connection'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/fixtures.rb:516:in `create_fixtures'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/fixtures.rb:1015:in `load_fixtures'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/fixtures.rb:988:in `setup_fixtures'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/fixtures.rb:852:in `before_setup'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-rails-3.6.1/lib/rspec/rails/adapters.rb:126:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:447:in `instance_exec'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:447:in `instance_exec'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:375:in `execute_with'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:606:in `block (2 levels) in run_around_example_hooks_for'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:342:in `call'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:607:in `run_around_example_hooks_for'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:464:in `run'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:457:in `with_around_example_hooks'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:500:in `with_around_and_singleton_context_hooks'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:251:in `run'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:627:in `block in run_examples'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:623:in `map'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:623:in `run_examples'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:589:in `run'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:590:in `block in run'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:590:in `map'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:590:in `run'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:118:in `block (3 levels) in run_specs'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:118:in `map'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:118:in `block (2 levels) in run_specs'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/configuration.rb:1894:in `with_suite_hooks'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:113:in `block in run_specs'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:79:in `report'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:112:in `run_specs'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:87:in `run'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:71:in `run'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:45:in `invoke'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/gems/rspec-core-3.6.0/exe/rspec:4:in `<top (required)>'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/bin/rspec:23:in `load'
# /home/vagrant/.bundle/easypost_admin/ruby/2.3.0/bin/rspec:23:in `<top (required)>'
# /opt/ruby2.3/lib64/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `load'
# /opt/ruby2.3/lib64/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `kernel_load'
# /opt/ruby2.3/lib64/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:24:in `run'
# /opt/ruby2.3/lib64/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli.rb:304:in `exec'
# /opt/ruby2.3/lib64/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
# /opt/ruby2.3/lib64/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
# /opt/ruby2.3/lib64/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
# /opt/ruby2.3/lib64/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
# /opt/ruby2.3/lib64/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
# /opt/ruby2.3/lib64/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
# /opt/ruby2.3/lib64/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
# /opt/ruby2.3/lib64/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
# /vagrant/easypost_admin/vendor/bundle/bundle:23:in `load'
# /vagrant/easypost_admin/vendor/bundle/bundle:23:in `<main>'
#
# Showing full backtrace because every line was filtered out.
# See docs for RSpec::Configuration#backtrace_exclusion_patterns and
# RSpec::Configuration#backtrace_inclusion_patterns for more information.
Finished in 0.0058 seconds (files took 2.29 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/controllers/application_controller_spec.rb:15 # ApplicationController the truth false not equal true
UPDATE
rails_help.rb
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!
# Checks for pending migration and applies them before tests are run.
# If you are not using ActiveRecord, you can remove this line.
# ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
# config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = false
# The different available types are documented in the features, such as in
# https://relishapp.com/rspec/rspec-rails/docs
config.infer_spec_type_from_file_location!
# Filter lines from Rails gems in backtraces.
config.filter_rails_from_backtrace!
end
spec_helper.rb
RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end
config.shared_context_metadata_behavior = :apply_to_host_groups
end
I had the very same issue with a rails 5.2.0.alpha app without a database
configured. So I had a look at the rspec-rails code, and figured out this
line which causes all the trouble:
rspec-rails/lib/rspec/rails/fixture_support.rb:
if defined?(ActiveRecord::TestFixtures)
It checks for a loaded ActiveRecord constant, which actually was loaded. I
also had require 'active_record/railtie' commented out from
config/application.rb. Then I figured out who required the ActiveStorage gem
(bundle.lock). In my case it was ActiveStorage.
I just use the ActiveStorage functionality without a database, so I had to
remove the ActiveRecord constant on my spec/rails_helper.rb:
# frozen_string_literal: true
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Remove the ActiveRecord constant, because it is autloaded by
# ActiveStorage and not needed for our application. The presence
# of the ActiveRecord constant causes rspec-rails to include
# extra fixture support, which results in:
#
# ActiveRecord::ConnectionNotEstablished:
# No connection pool with 'primary' found.
#
Object.send(:remove_const, :ActiveRecord)
Mind the order, it needs to be placed after
require File.expand_path('../../config/environment', __FILE__)
and before
require 'rspec/rails'
This solution just modify the test environment.
UPDATE
I create an issue on rspec-rails which targets the creation of a global rspec configuration to turn off ActiveRecord handling.
A fix for this has just been merged into rspec-rails, and will supposedly be released along with RSpec Rails 4.0 sometimes next week.
What you have to set the following in your spec/rails_helper.rb:
config.use_active_record = false
Again, the problem is that if you didn't configure/use the database connection, but ActiveRecord is still present (due to Bundler loading it or some other reasons).

Poltergeist/PhantomJS crashing in Gitlab CI

Background:
My testing suite did not handle any JS functionality until recently. I started out
only on my machine with a selenium-webdriver javascript driver and firefox 47.0.1
with no issues. I then migrated over to poltergeist supporting PhantomJS as
my javascript driver. I had to make a few changes to some broken tests, but have
very much enjoyed the changeover and am 'sold' on PhantomJS/poltergeist.
Expected Behavior:
I anticipated the tests to pass on my Gitlab-ci just as they had on my machine
(hey, we can dream), with maybe a few configuration tweaks needed.
Versions:
Ruby - 2.3.1
Rails - 5.0.0.1
poltergeist - 1.12.0
rspec - 3.5.0
rspec-rails - 3.5.1
capybara - 2.11.0
cliver - 0.3.2
factory_girl_rails - 4.7.0
phantomjs - 2.1.1 (on both my machine and CI server)
Capybara Config:
require 'capybara/rspec'
require 'capybara/poltergeist'
Capybara.default_driver = :rack_test
Capybara.register_driver :poltergeist do |app|
options = {
:js_errors => false,
:timeout => 360,
:phantomjs_options => ['--load-images=no', '--ignore-ssl-errors=yes', '--disk-cache=false']
}
Capybara::Poltergeist::Driver.new(app, options)
end
Capybara.javascript_driver = :poltergeist
DatabaseCleaner Config
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = Capybara.current_driver == :rack_test ? :transaction : :truncation
DatabaseCleaner.clean
DatabaseCleaner.start
end
config.after(:each) do |example|
puts 'RAM USAGE: ' + `pmap #{Process.pid} | tail -1`[10,40].strip
if defined?(page)
Capybara.reset_sessions!
page.driver.restart
end
DatabaseCleaner.clean
end
Actual Behavior/Backtraces:
1. Failing Tests, PhantomJS Crash
To get a full stacktrace on my failing tests before I ate up all of my memory I
used the rspec --fail-fast option to kick back results for me on my first error.
This is what I returned:
ArgumentError:
The detector #<struct Cliver::Detector command_arg=nil, version_pattern=nil> failed to detect theversion of the executable at '/usr/bin/phantomjs'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:191:in `detect_version'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:87:in `block in installed_versions'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:214:in `block in find_executables'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:208:in `map'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:208:in `find_executables'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:86:in `each'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:86:in `installed_versions'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:108:in `each'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:108:in `detect!'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:97:in `detect'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/cliver-0.3.2/lib/cliver.rb:35:in `detect'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/poltergeist-1.12.0/lib/capybara/poltergeist/client.rb:47:in `initialize'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/poltergeist-1.12.0/lib/capybara/poltergeist/client.rb:14:in `new'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/poltergeist-1.12.0/lib/capybara/poltergeist/client.rb:14:in `start'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/poltergeist-1.12.0/lib/capybara/poltergeist/driver.rb:44:in `client'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/poltergeist-1.12.0/lib/capybara/poltergeist/driver.rb:25:in `browser'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/poltergeist-1.12.0/lib/capybara/poltergeist/driver.rb:183:in `reset!'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/capybara-2.11.0/lib/capybara/session.rb:110:in `reset!'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/capybara-2.11.0/lib/capybara.rb:335:in `block in reset_sessions!'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/capybara-2.11.0/lib/capybara.rb:335:in `reverse_each'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/capybara-2.11.0/lib/capybara.rb:335:in `reset_sessions!'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/capybara-2.11.0/lib/capybara/rspec.rb:21:in `block (2 levels) in <top (required)>'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:443:in `instance_exec'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:443:in `instance_exec'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:357:in `run'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:507:in `block in run_owned_hooks_for'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:506:in `each'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:506:in `run_owned_hooks_for'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:593:in `block in run_example_hooks_for'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:592:in `each'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:592:in `run_example_hooks_for'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:463:in `run'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:503:in `run_after_example'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:269:in `block in run'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:496:in `block in with_around_and_singleton_context_hooks'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:453:in `block in with_around_example_hooks'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:464:in `block in run'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:604:in `block in run_around_example_hooks_for'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:338:in `call'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-rails-3.5.1/lib/rspec/rails/adapters.rb:127:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:443:in `instance_exec'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:443:in `instance_exec'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:375:in `execute_with'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:606:in `block (2 levels) in run_around_example_hooks_for'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:338:in `call'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-retry-0.4.5/lib/rspec/retry.rb:98:in `block in run'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-retry-0.4.5/lib/rspec/retry.rb:88:in `loop'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-retry-0.4.5/lib/rspec/retry.rb:88:in `run'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-retry-0.4.5/lib/rspec_ext/rspec_ext.rb:12:in `run_with_retry'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-retry-0.4.5/lib/rspec/retry.rb:22:in `block (2 levels) in setup'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:443:in `instance_exec'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:443:in `instance_exec'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:375:in `execute_with'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:606:in `block (2 levels) in run_around_example_hooks_for'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:338:in `call'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:607:in `run_around_example_hooks_for'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:464:in `run'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:453:in `with_around_example_hooks'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:496:in `with_around_and_singleton_context_hooks'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:251:in `run'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:627:in `block in run_examples'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:623:in `map'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:623:in `run_examples'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:589:in `run'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:113:in `block (3 levels) in run_specs'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:113:in `map'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:113:in `block (2 levels) in run_specs'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1835:in `with_suite_hooks'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:112:in `block in run_specs'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/reporter.rb:77:in `report'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:111:in `run_specs'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:87:in `run'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:71:in `run'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.5.4/exe/rspec:4:in `<top (required)>'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/bin/rspec:23:in `load'
# /home/gitlab-runner/builds/wow_such_build/0/schwad_project/redacted/vendor/bundle/ruby/2.3.0/bin/rspec:23:in `<main>'
#
# Showing full backtrace because every line was filtered out.
# See docs for RSpec::Configuration#backtrace_exclusion_patterns and
# RSpec::Configuration#backtrace_inclusion_patterns for more information.
Also, in my gitlab-ci.yml file, if I call phantomjs --version in before_script I receive:
QXcbConnection: Could not connect to display
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.
Any help on this would be much appreciated.
2. Memory Blowup SOLVED: see update 2
The tests would eat up the memory, even after we increased memory capacity on the
servers, and crash the test suite before it would finish. To track memory usage
in my RSpec configuration after each test I ran:
puts 'enter code hereRAM USAGE: ' +pmap #{Process.pid} | tail -1[10,40].strip
The memory would be minimally affected under the model tests, but grow rapidly
under the integration tests. Like so:
Model Test-
RAM USAGE: 567800K
Model Test-
RAM USAGE: 567800K
Model Test-
RAM USAGE: 567800K
Model Test-
RAM USAGE: 568220K
Model Test-
RAM USAGE: 568220K
Model Test-
RAM USAGE: 568360K
Model Test-
RAM USAGE: 568500K
Model Test-
RAM USAGE: 568652K
Model Test-
RAM USAGE: 568788K
First Feature Test:
RAM USAGE: 1100628K
And blowing up from there.
To handle this I have made sure to use appropriate DatabaseCleaner strategies,
also cycled through trying tools such as Capybara.reset_sessions!,
Capybara.current_session.driver.quit, page.driver.quit, page.driver.restart
with no real joy.
UPDATE:
5:06 PM UTC, 15/12/16
1. Crashes
Gitlab support has suggested investigating whether our packages and dependencies are resulting in a non-headless situation with PhantomJS. We are investigating this now.
2. Memory
I've run a memory tracker against a few different iterations here, and it seems to be simply enabling our js: true feature tests with a javascript driver to be eating up the memory, going from 1G for about 1,750 tests to surpassing our 4G limit on 1,800-1,850 tests. This seems to occur, I believe, with either selenium-webdriver OR poltergeist as the js driver.
UPDATE 2:
11:45 PM UTC, 16/12/16
1. Crashing
Still awaiting proper installation of packages on our server. Will update and award answer if this is the issue.
2. Memory
On the branch where we were migrating over to the Javascript-driver enabled batch of tests, part of the configuration to speed up the tests implemented a DeferredGarbageCollector which had settings that gobbled up the memory. PhantomJS and Poltergeist are not leaking. SOLVED
http://github.com/ariya/phantomjs/issues/14240 is the cause of your PhantomJS crashing - The version of PhantomJS shipped by Ubuntu requires X to run.
Download the official release build and use that to cure your crashing issue.
You may want to add the memory issue as a separate question.

RSpec and "uninitialized constant Features" error

When I run rspec test I get:
/home/jasiek/Desktop/katowice-ror-workshops-2015/spec/support/features.rb:2:in `block in ': uninitialized constant Features (NameError)
I suppose problem is only on my local machine because this is repo from trust source (another users haven't got this problem). The repo I'm talking about: https://github.com/netguru-training/katowice-ror-workshops-2015
I read on Stack that the problem could be missing line:
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
But I've got it.
Where could be a problem?
And this is a whole log from console:
jasiek#jasiek-HP-EliteBook-8470p:~/Desktop/katowice-ror-workshops-2015$ RAILS_ENV=test bundle exec rspec
/home/jasiek/Desktop/katowice-ror-workshops-2015/spec/support/features.rb:2:in block in <top (required)>': uninitialized constant Features (NameError)
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/gems/rspec-core-3.3.0/lib/rspec/core.rb:97:inconfigure'
from /home/jasiek/Desktop/katowice-ror-workshops-2015/spec/support/features.rb:1:in <top (required)>'
from /home/jasiek/Desktop/katowice-ror-workshops-2015/spec/rails_helper.rb:23:inblock in '
from /home/jasiek/Desktop/katowice-ror-workshops-2015/spec/rails_helper.rb:23:in each'
from /home/jasiek/Desktop/katowice-ror-workshops-2015/spec/rails_helper.rb:23:in'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:in require'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:inblock in requires='
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:in each'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:inrequires='
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:109:in block in process_options_into'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:108:ineach'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:108:in process_options_into'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:21:inconfigure'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:101:in setup'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:88:inrun'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:73:in run'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:41:ininvoke'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/gems/rspec-core-3.3.0/exe/rspec:4:in <top (required)>'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/bin/rspec:23:inload'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/bin/rspec:23:in <main>'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/bin/ruby_executable_hooks:15:ineval'
from /home/jasiek/.rvm/gems/ruby-2.2.0-preview1/bin/ruby_executable_hooks:15:in `'
I know its late.
But for other people who may come here for searching the answer. I was facing the same issue.
So when I checked rails_helper.rb file inside spec I found that this line
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
was commented initially so I un-commented it and everything worked fine.
I am using
gem 'capybara', '~> 2.15', '>= 2.15.4'
gem 'rspec-rails', '~> 3.6'
Try adding the following in your spec/support/features.rb file:
require '../../spec/support/features/session_helpers'
So, it becomes:
require '../../spec/support/features/session_helpers'
RSpec.configure do |config|
config.include Features::SessionHelpers, type: :feature
end

Getting spork to work with Ruby 1.9.2/3 + Rails 3.1 + Rspec?

There's quite a few solid tutorials out there, and I haven't had too much trouble getting this working in the past. But, after hours of trying, I must be missing something.
I've completed the standard installation instructions, and started up the spork server:
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
Looking good.
Then, I hop over to a new tab and run my specs:
$ rspec spec
This command returns nothing after running for only a split second. So I jump back to the spork server to see what happened and get:
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
Running tests with args ["--color", "spec"]...
Exception encountered: #<DRb::DRbConnError: druby://localhost:56736 - #<Errno::ECONNREFUSED: Connection refused - connect(2)>>
backtrace:
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:736:in `rescue in block in open'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:730:in `block in open'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:729:in `each'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:729:in `open'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1191:in `initialize'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1171:in `new'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1171:in `open'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1087:in `block in method_missing'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1105:in `with_friend'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1086:in `method_missing'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1074:in `respond_to?'
/Users/briancody/.rvm/gems/ruby-1.9.3-p0#scholastica/gems/spork-0.9.0.rc9/lib/spork/run_strategy/forking.rb:10:in `block in run'
/Users/briancody/.rvm/gems/ruby-1.9.3-p0#scholastica/gems/spork-0.9.0.rc9/lib/spork/forker.rb:21:in `block in initialize'
/Users/briancody/.rvm/gems/ruby-1.9.3-p0#scholastica/gems/spork-0.9.0.rc9/lib/spork/forker.rb:18:in `fork'
/Users/briancody/.rvm/gems/ruby-1.9.3-p0#scholastica/gems/spork-0.9.0.rc9/lib/spork/forker.rb:18:in `initialize'
/Users/briancody/.rvm/gems/ruby-1.9.3-p0#scholastica/gems/spork-0.9.0.rc9/lib/spork/run_strategy/forking.rb:9:in `new'
/Users/briancody/.rvm/gems/ruby-1.9.3-p0#scholastica/gems/spork-0.9.0.rc9/lib/spork/run_strategy/forking.rb:9:in `run'
/Users/briancody/.rvm/gems/ruby-1.9.3-p0#scholastica/gems/spork-0.9.0.rc9/lib/spork/server.rb:48:in `run'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
/Users/briancody/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
Done.
For some reason, drb is failing to connect? I've googled like crazy, but there just doesn't seem to be anything helpful out there.
Some possible clues
The port (in this case 56736) changes every time I attempt to run the suite
I get the same result on both ruby 1.9.2 and ruby 1.9.3
I'm using a mac (snow leopard) and firewalls are disabled
I've tried it on a totally different mac (also snow leopard) with the same result.
I'm using the latest version of cucumber, rspec, and spork.
I also setup cucumber spork and it failed the same way.
As you can see, I've been banging away at it for a while. My project uses a lot of gems and not having spork makes testing really, really terrible. Please help...
UPDATE
Here's my spec_helper:
require 'spork'
Spork.prefork do
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require "email_spec"
require 'webmock/rspec'
require 'vcr'
require 'database_cleaner'
include Devise::TestHelpers
include EmailSpec::Helpers
include EmailSpec::Matchers
# Stub all updates to search indexes
class Profile
def update_tank_indexes ; end
def delete_tank_indexes ; end
end
class Journal
def update_tank_indexes ; end
end
# Apparently rspec doesn't understand <tt>main_app</tt> so stub it out.
def main_app ; self ; end
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
config.mock_with :rspec
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
config.extend VCR::RSpec::Macros
# Always clean the database after running describe/context blocks to ensure a
# consistent state. This is especially important when using the <tt>rspec-set</tt>
# method. This method creates setup object once -- and only once -- proir to
# running an entire describe/context block. In this way, it's similar to using
# <tt>before(:all)</tt> except that <tt>set</tt> is better because:
#
# * It automatically reloads the object before each example, making it much
# safer than before(:all) which can cause bugs if you're not careful.
# * It's lazily evaluated.
#
# You can read more at:
#
# * eggsonbread.com/2010/05/25/speed-up-your-specs-with-set/
# * github.com/pcreux/rspec-set
#
# Note: This is not part of default configuration. Be sure to retain this snippet
# when upgrading.
#
DatabaseCleaner.strategy = :truncation
config.before(:all) do
DatabaseCleaner.clean
end
config.after(:suite) do
DatabaseCleaner.clean
end
end
end
Spork.each_run do
# This code will be run each time you run your specs.
end
I opened a ticket for this issue, but nothing has come of it in the last 3.5 months: https://github.com/sporkrb/spork/issues/133
Update: I found the solution, and reported everything to that ticket. tl;dr: change your Gemfile entry for 'always_validate_ssl_certifitcates' to include :require => false.
Can you roll back to spork 0.8.5 and see if it works? I've just verified that working.

Error running cucumber tests - no such file to load

I have a rails app with Cucumber 1.0.0 and cucumber-rails 1.0.2. These tests ran fine last night. Today I just altered some step definitions and tried to run the tests and got the error below. I haven't changed anything in the cucumber support files. Any ideas?
grouperty $ cucumber
Using the default profile...
no such file to load -- /Users/davidtuite/wd/grouperty/features/config/environment(LoadError)
/Users/davidtuite/.rvm/rubies/ruby-1.9.2-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/davidtuite/.rvm/rubies/ruby-1.9.2-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/davidtuite/wd/grouperty/features/support/env.rb:12:in `block in <top (required)>'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/gems/spork-0.9.0.rc9/lib/spork.rb:24:in `prefork'
/Users/davidtuite/wd/grouperty/features/support/env.rb:10:in `<top (required)>'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/gems/cucumber-1.0.0/lib/cucumber/rb_support/rb_language.rb:143:in `load'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/gems/cucumber-1.0.0/lib/cucumber/rb_support/rb_language.rb:143:in `load_code_file'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/gems/cucumber-1.0.0/lib/cucumber/runtime/support_code.rb:176:in `load_file'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/gems/cucumber-1.0.0/lib/cucumber/runtime/support_code.rb:78:in `block in load_files!'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/gems/cucumber-1.0.0/lib/cucumber/runtime/support_code.rb:77:in `each'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/gems/cucumber-1.0.0/lib/cucumber/runtime/support_code.rb:77:in `load_files!'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/gems/cucumber-1.0.0/lib/cucumber/runtime.rb:137:in `load_step_definitions'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/gems/cucumber-1.0.0/lib/cucumber/runtime.rb:39:in `run!'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/gems/cucumber-1.0.0/lib/cucumber/cli/main.rb:43:in `execute!'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/gems/cucumber-1.0.0/lib/cucumber/cli/main.rb:20:in `execute'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/gems/cucumber-1.0.0/bin/cucumber:14:in `<top (required)>'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/bin/cucumber:19:in `load'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/bin/cucumber:19:in `'
Here is the content of /features/support/env.rb. Note that most of it was generated by the spork gem (v0.9.0.rc9).
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
require 'rubygems'
require 'spork'
Spork.prefork do
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'cucumber/rails'
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
# order to ease the transition to Capybara we set the default here. If you'd
# prefer to use XPath just remove this line and adjust any selectors in your
# steps to use the XPath syntax.
Capybara.default_selector = :css
end
Spork.each_run do
# By default, any exception happening in your Rails application will bubble up
# to Cucumber so that your scenario will fail. This is a different from how
# your application behaves in the production environment, where an error page will
# be rendered instead.
#
# Sometimes we want to override this default behaviour and allow Rails to rescue
# exceptions and display an error page (just like when the app is running in production).
# Typical scenarios where you want to do this is when you test your error pages.
# There are two ways to allow Rails to rescue exceptions:
#
# 1) Tag your scenario (or feature) with #allow-rescue
#
# 2) Set the value below to true. Beware that doing this globally is not
# recommended as it will mask a lot of errors for you!
#
ActionController::Base.allow_rescue = false
# Remove/comment out the lines below if your app doesn't have a database.
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
begin
DatabaseCleaner.strategy = :transaction
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
# See the DatabaseCleaner documentation for details. Example:
#
# Before('#no-txn,#selenium,#culerity,#celerity,#javascript') do
# DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
# end
#
# Before('~#no-txn', '~#selenium', '~#culerity', '~#celerity', '~#javascript') do
# DatabaseCleaner.strategy = :transaction
# end
#
end
this line
require File.expand_path("../../config/environment", __FILE__)
requires
/Users/davidtuite/wd/grouperty/features/config/environment
which is not present there this causes error

Resources