This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def login_as(user) | |
raise "Was expecting a User. Got a #{user.class} instead. Exiting." if user.class != User | |
@controller.request.env['warden'] = mock( | |
Warden, | |
:authenticate => user, | |
:authenticate! => user, | |
:authenticated? => true, | |
:authenticate? => true | |
) | |
user.last_sign_in_at = Time.now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def element_visible?(element_id) | |
# does the element exist? | |
exists = page.has_css?(element_id) | |
# is the element itself hidden with the .ui-helper-hidden class? | |
self_hidden = page.has_css?("#{element_id}.ui-helper-hidden") | |
# is the parent of the element hidden, thus hiding the element? | |
parent_hidden = page.has_css?(".ui-helper-hidden > #{element_id}") |