I have quite some issues with testing the features of my rails application using RSpec. I have a company controller, and are using devise to make sure that you need to be logged in to access the controller.
I then have integration tests like the following:
describe "with valid information" do
before do
fill_in "company_address", with: "My special address"
fill_in "company_name", with: "My User"
fill_in "company_contact_email", with: "test@test.com"
fill_in "company_contact_name", with: "Someone Hello"
end
it "should create a company" do
expect { click_button submit }.to change(Company, :count).by(1)
end
end
It, of course, fails because I don't have a user who is logged in. I have tried creating a test helper like described here, and it works well for controllers, but not for integration tests.
What is the best way to log a user in with Devise, prior to these tests?