spec/requests/pwb/sessions_spec.rb in pwb-0.0.1 vs spec/requests/pwb/sessions_spec.rb in pwb-0.0.2

- old
+ new

@@ -1,12 +1,13 @@ require 'rails_helper' module Pwb RSpec.describe "Sessions", type: :request do before(:all) do - @agency = FactoryGirl.create(:pwb_agency, company_name: 'my re') - @admin_user = User.create!(email: "user@example.org", password: "very-secret", admin:true) + @agency = Agency.last || FactoryGirl.create(:pwb_agency, company_name: 'my re') + + @admin_user = User.create!(email: "user@example.org", password: "very-secret", admin: true) end it "signs user in and out" do sign_in @admin_user get pwb.admin_path @@ -16,10 +17,9 @@ sign_out @admin_user get "/admin" # expect(controller.current_user).to be_nil expect(response).to redirect_to(pwb.new_user_session_path) end - after(:all) do @agency.destroy @admin_user.destroy end