Sha256: f12de432759bb45fdc81751f64c52ba760679bdae3a86fae46b08becf076ea56

Contents?: true

Size: 699 Bytes

Versions: 5

Compression:

Stored size: 699 Bytes

Contents

require 'capybara/dsl'
require 'factory_girl'

module ActionDispatch
  class IntegrationTest
    include Capybara::DSL

    Capybara.javascript_driver = :webkit

    def login(role = nil)
      logout
      user(role)
      visit new_user_session_path(:lang => :de)
      fill_in "E-Mail", :with => user.email
      fill_in "Passwort", :with => user.password
      click_button "Anmelden"
    end

    def logout
      visit dashboard_path(:lang => :de)
      click_link_or_button "Abmelden" if page.has_link?("Abmelden")
      @user.try(:destroy)
      @user = nil
    end

    def user(role = nil)
      @user ||= FactoryGirl.create(:user, :role => (role || User.default_role))
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
iqvoc-4.3.3 test/capybara_helper.rb
iqvoc-4.3.2 test/capybara_helper.rb
iqvoc-4.3.1 test/capybara_helper.rb
iqvoc-4.3.0 test/capybara_helper.rb
iqvoc-4.2.0 test/capybara_helper.rb