RSpec is very specific in the directory in which you place your tests. If you put the test in the wrong directory, it will not automatically mix different test assistants that install different types of tests. It seems your installation uses spec/features , which is not an approved standard directory ( spec/requests , spec/integration or spec/api ).
Based on the tutorial page, I'm not sure how their spec_helper.rb file settings are spec_helper.rb . Although examples, so they use spec/requests for testing.
You can force RSpec to recognize another directory for query specifications using the following functions:
Manually add the proper module to the test file:
# spec/features/pages/index_spec.rb require 'spec_helper' describe "Visiting the index page" do include RSpec::Rails::RequestExampleGroup
Include this in your spec/spec_helper.rb file:
RSpec::configure do |c| c.include RSpec::Rails::RequestExampleGroup, type: :request, example_group: { file_path: c.escaped_path(%w[spec (features)]) } end
Since this is a tutorial, I would recommend following the require 'spec_helper' inclusion standard at the top of the spec file and that your actual spec/spec_helper.rb has require 'rspec/rails'
A quick note, you do not need to put specify inside the it block. They are aliases for each other, so just use them.
context "when the a user has logged in and attempts to visit the page" do let(:user) { FactoryGirl.create :user } before do log_in user end
Note that as per the documentation for capybara, you can put your capybara tests in spec/features . To make this work, make sure you load require 'capybara/rspec' into your spec_helper or directly into the test file.
However, looking at the source , I did not see where they automatically include this directory. You can also try adding the type: :feature tag to the external describe block in the test file. Although the most likely solution is to use spec/requests .