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

Version Path
pah-0.0.12 lib/pah/files/spec/support/acceptance_helpers.rb
pah-0.0.11 lib/pah/files/spec/support/acceptance_helpers.rb
pah-0.0.10 lib/pah/files/spec/support/acceptance_helpers.rb
pah-0.0.9 lib/pah/files/spec/support/acceptance_helpers.rb
pah-0.0.8 lib/pah/files/spec/support/acceptance_helpers.rb
pah-0.0.7 lib/pah/files/spec/support/acceptance_helpers.rb
pah-0.0.6 lib/pah/files/spec/support/acceptance_helpers.rb
pah-0.0.5 lib/pah/files/spec/support/acceptance_helpers.rb
pah-0.0.4 lib/pah/files/spec/support/acceptance_helpers.rb
pah-0.0.3 lib/pah/files/spec/support/acceptance_helpers.rb
pah-0.0.2 lib/pah/files/spec/support/acceptance_helpers.rb
pah-0.0.1 lib/pah/files/spec/support/acceptance_helpers.rb