0
votes

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 `'

2

2 Answers

3
votes

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'
1
votes

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