undefined method `sign_in' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x1057fd428> error while trying to set up RSpec with Devise
问题 I've got a spec/controllers/add_to_carts_spec.rb : require 'spec_helper' describe CartItemsController do before (:each) do @user = Factory(:user) sign_in @user end describe "add stuff to the cart" do it "should add a product to the cart" do product = FactoryGirl.create(:product) visit products_path(product) save_and_open_page click_on('cart_item_submit') end end end and /spec/support/spec_helper.rb : # This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] |