Commit 88ff636
Changed files (3)
spec
spec/controllers/items_controller_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe ItemsController, type: :controller do
let(:user) { create(:user) }
before :each do
- session[:user_id] = user.id
+ auth_user(user)
end
describe "#index" do
spec/support/http_authentication.rb
@@ -0,0 +1,5 @@
+module HttpAuthentication
+ def auth_user(user)
+ session[:user_id] = user.id
+ end
+end
spec/rails_helper.rb
@@ -32,6 +32,7 @@ RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.include FactoryGirl::Syntax::Methods
+ config.include HttpAuthentication
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false