Sha256: 3f4621c941e8df605d237c23aeb041c9386219622f46eb5aa2839306c455ef0f

Contents?: true

Size: 779 Bytes

Versions: 1

Compression:

Stored size: 779 Bytes

Contents

module FeatureMacros
  def login(user = nil, skip_site = false)
    setup_site unless skip_site
    user ||= FactoryGirl.create(:user)
    visit new_user_session_path
    
    fill_in "user_email", :with => user.email
    fill_in "user_password", :with => user.password
    
    click_on "Log In"
    page.should have_content("Signed in successfully.")
    @current_user = user
  end

  def login_admin(admin = nil)
    login FactoryGirl.create(:admin)
  end

  def login_editor(editor = nil)
    login FactoryGirl.create(:editor)
  end

  def login_writer(writer = nil)
    login FactoryGirl.create(:writer)
  end
  
  def current_user
    @current_user
  end

  def current_site
    @current_site
  end

  def setup_site
    @current_site = FactoryGirl.create(:site)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
storytime-0.0.1 spec/support/feature_macros.rb