Sha256: 0ec974ce1d2a08d76d460776f11f3019381d6af52e980470ba025677d8b35df9
Contents?: true
Size: 1013 Bytes
Versions: 12
Compression:
Stored size: 1013 Bytes
Contents
# -*- encoding : utf-8 -*- module AcceptanceHelpers def saop save_and_open_page end def handle_js_confirm(message = nil, accept = true) page.execute_script("window.original_confirm_function = window.confirm") page.execute_script("window.confirm = function(msg) { $.cookie('confirm_message', msg); return #{!!accept}; }") yield page.evaluate_script("$.cookie('confirm_message')").should == message unless message.nil? ensure page.evaluate_script "window.confirm = window.original_confirm_function" end def fill_in_autocomplete(capybara_selector, jquery_selector, value) fill_in capybara_selector, :with => value page.execute_script %Q{$('#{jquery_selector}').keydown()} end def choose_autocomplete(text) find('ul.ui-autocomplete').should have_content(text) page.execute_script("$('.ui-menu-item:contains(\"#{text}\")').find('a').trigger('mouseenter').click()") end end RSpec.configure do |config| config.include AcceptanceHelpers, :type => :request end
Version data entries
12 entries across 12 versions & 1 rubygems