2
votes

I'm following the NetTuts intro to Rails screencast to get a better handle on rspec/capybara/guard etc. and after a few errors I cannot get passed this one:

/home/jonlee/.rvm/gems/ruby-2.1.1@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara/rails.rb:15:in `<top (required)>': undefined method `join' for nil:NilClass (NoMethodError)
    from /home/jonlee/Projects/rails/guardtest/spec/spec_helper.rb:3:in `require'
    from /home/jonlee/Projects/rails/guardtest/spec/spec_helper.rb:3:in `<top (required)>'

My spec_helper is as follows:

require 'rails'
require 'rspec/core'
require 'capybara/rails'


RSpec.configure do |config|
    config.include Capybara::DSL
    end

my gemfile has:

group :test, :development do
  gem 'rspec-core'
  gem 'capybara'
  gem 'guard-rspec'
end

im using: Ruby - 2.1.1 Rails - 4.0.5 rspec - 3.0.1 capybara - 2.3.0

Even after suggestion of changing spec_helper.rb file to require 'rspec/core' and changing gem to rspec-core I still have this error.

Does the order in the spec_helper matter or do I need to perform some further work in the Rspec.configure block?

GIT - https://github.com/JonleePeakman/guardtest

1

1 Answers

1
votes

Your gemfile has gem 'rspec-core'. It should be gem 'rspec-rails'.

You have RSpec 3.0.1 and there are big changes in configuration compared to previous versions. Be careful not to follow outdated tutorials or blog posts. Have you used the RSpec generator to set up RSpec?

$ rails generate rspec:install

You should have files:

.rspec
spec/spec_helper.rb
spec/rails_helper.rb

Capybara will work "out of the box" without any changes to the configuration files. Try removing your spec/spec_helper.rb file and use the RSpec generator to set things up.

As an alternative to the NetTuts tutorial, you might want to look at the RSpec Tutorial I've written which is up to date with RSpec 3.0.