Sha256: 9a74fd705852aba3184306c8e84dea531a585889735ab15c3da6701107c4826e

Contents?: true

Size: 791 Bytes

Versions: 9

Compression:

Stored size: 791 Bytes

Contents

module PageHelper
  def ensure_path path
    expect(page.current_path).to eq path
  end
  def visit_path path
    visit path
    expect(status_code).to be 200
    expect(page).not_to have_css(".translation_missing")
    ensure_path path
  end

  def ensure_admin
    admin = Clerk.where(:admin => true).first
    admin = create :admin unless admin
    expect(admin).not_to be nil
    admin
  end
  
  def sign_in
    admin = ensure_admin
    visit sign_in_path
    fill_in "email" , :with => admin.email
    fill_in "password" , :with => "password"
    click_button I18n.t(:sign_in)
    expect(page).to have_content I18n.t(:baskets)
  end

  def expect_basket_total price
    expect(find(".total").text).to include( price.round(2).to_s.sub(".",",")) # TODO remove the format hack 
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
post_clerk-0.6 spec/support/request_helper.rb
accountant_clerk-0.8 spec/support/request_helper.rb
post_clerk-0.5 spec/support/request_helper.rb
accountant_clerk-0.7 spec/support/request_helper.rb
accountant_clerk-0.6 spec/support/request_helper.rb
office_clerk-0.5 spec/support/request_helper.rb
office_clerk-0.4 spec/support/request_helper.rb
office_clerk-0.1 spec/support/request_helper.rb
office_clerk-0.0.1 spec/support/request_helper.rb