Update and fix test kitchet to be conformant with poltergeist

This commit is contained in:
KalabiYau 2014-07-04 22:35:47 +02:00 committed by Artem Chernikov
parent 7f710ec72d
commit dbb210908b
6 changed files with 62 additions and 34 deletions

View file

@ -0,0 +1,10 @@
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || retrieve_connection
end
end
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection

View file

@ -1,17 +1,14 @@
module LoginMacros
include Warden::Test::Helpers
Warden.test_mode!
def sign_in(user)
visit new_user_session_path
fill_in 'user_email', with: user.email
fill_in 'user_password', with: user.password
find(:xpath, "//div[@id='content']//button[@type='submit']").click
expect(page.has_content?('Signed in successfully')).to be true
login_as(user, :scope => :user)
end
def sign_out
Capybara.current_session.driver.browser.clear_cookies
visit root_path
expect(page.has_content?('Sign In')).to be true
logout(:user)
end
end