Update and fix test kitchet to be conformant with poltergeist
This commit is contained in:
parent
7f710ec72d
commit
dbb210908b
6 changed files with 62 additions and 34 deletions
10
spec/support/kneet_connections.rb
Normal file
10
spec/support/kneet_connections.rb
Normal 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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue