I'm trying to write a Sign in integration test for my app + devise by using Capybara.
Here is what I have so far:
require 'spec_helper'
describe "the signup process", :type => :request do
before :each do
@user_1 = Factory.create(:user, :email => '[email protected]', :password => 'iPassword')
end
it "signs me in" do
visit new_user_session_path
fill_in 'user[email]', :with => '[email protected]'
fill_in 'user[password]', :with => 'iPassword'
click_link_or_button 'Sign In'
end
end
This is passing. Problem here is that it isn't checking that the user was signed in (cookie?) and that the url redirected correctly?
How can I add those details to this test? Also for an invalid login, how can I test to make sure the flash alert was set correctly?
Thank you