rspec - unable to setup capybara in Rails -


i learning how integration testing on simple app in rails using capybara.

however got error when running 'rspec spec':

bundle exec rspec spec /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara/dsl.rb:1: warning: loading in progress, circular require considered harmful - /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara.rb     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin/ruby_executable_hooks:15:in `<main>'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin/ruby_executable_hooks:15:in `eval'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin/rspec:23:in `<main>'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin/rspec:23:in `load'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/exe/rspec:4:in `<top (required)>'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:38:in `invoke'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:70:in `run'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:85:in `run'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:96:in `setup'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration_options.rb:22:in `configure'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration_options.rb:100:in `process_options_into'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration_options.rb:100:in `each'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration_options.rb:101:in `block in process_options_into'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1018:in `requires='     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1018:in `each'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1018:in `block in requires='     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1018:in `require'     /home/alex/git-projects/rails-projects/qotd2/spec/spec_helper.rb:6:in `<top (required)>'     /home/alex/git-projects/rails-projects/qotd2/spec/spec_helper.rb:6:in `require'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara/rails.rb:1:in `<top (required)>'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara/rails.rb:1:in `require'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara.rb:5:in `<top (required)>'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara.rb:320:in `<module:capybara>'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara.rb:320:in `require'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara/dsl.rb:1:in `<top (required)>'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara/dsl.rb:1:in `require' /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara/node/matchers.rb:121: warning: assigned unused variable - e /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara/selenium/driver.rb:119: warning: assigned unused variable - /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara/rails.rb:6:in `block (2 levels) in <top (required)>': uninitialized constant rails (nameerror)     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rack-1.5.2/lib/rack/builder.rb:145:in `new'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rack-1.5.2/lib/rack/builder.rb:145:in `block in generate_map'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rack-1.5.2/lib/rack/builder.rb:145:in `each'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rack-1.5.2/lib/rack/builder.rb:145:in `generate_map'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rack-1.5.2/lib/rack/builder.rb:132:in `to_app'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara/rails.rb:13:in `<top (required)>'     /home/alex/git-projects/rails-projects/qotd2/spec/spec_helper.rb:6:in `require'     /home/alex/git-projects/rails-projects/qotd2/spec/spec_helper.rb:6:in `<top (required)>'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1018:in `require'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1018:in `block in requires='     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1018:in `each'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1018:in `requires='     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration_options.rb:101:in `block in process_options_into'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration_options.rb:100:in `each'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration_options.rb:100:in `process_options_into'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/configuration_options.rb:22:in `configure'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:96:in `setup'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:85:in `run'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:70:in `run'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:38:in `invoke'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/exe/rspec:4:in `<top (required)>'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin/rspec:23:in `load'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin/rspec:23:in `<main>'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin/ruby_executable_hooks:15:in `eval'     /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin/ruby_executable_hooks:15:in `<main>' 

my gemfile (partial):

group :test     gem 'fake'     gem 'capybara'     gem 'database_cleaner'     gem 'launchy' end  group :development, :test     gem 'rspec-rails'     gem 'factory_girl_rails'     gem 'guard-rspec'     gem 'growl'     gem 'dotenv-rails' end 

my test case (location: /spec/features/users_spec.rb):

require 'spec_helper'  describe 'user authentication'      context 'new user signs up'         "saves new user"              visit "/"             expect {                 click_button 'sign up'                 fill_in 'name', with: 'alexjiao'                 fill_in 'email', with: "alexjiao@yahoo.com"                 fill_in 'password', with: 'asdfasdf'                 fill_in 'password confirmation', with: 'asdfasdf'                 click_button 'create account'             }.to change(user, :count).by(1)         end     end  end 

my spec_helper.rb (location: /spec/spec_helper.rb):

require 'capybara/rails' require 'capybara/rspec'  rspec.configure |config|   config.include capybara::dsl end 

several solutions such putting test case in features folder , creating config statement capybara dsl here. can't seem capybara working. seems situation bit unique error message above. 1 thing take note of after running rails g rspec:install, spec_helper.rb empty (is normal?). hence accounts terse code above.

any thoughts?

remove --warnings .rspec

https://gist.github.com/melanievee/ad70fa90719c6c7f5398


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -