Sha256: 84b1033fc9992c372dcf5519d9d441c5ce6e09390ec9942fe63426f458c6dc1c

Contents?: true

Size: 930 Bytes

Versions: 1

Compression:

Stored size: 930 Bytes

Contents

require 'spec_helper'

feature "Login" do
  scenario "Login with invalid credentials" do
    sign_in_with_invalid_email
    page.should have_content "invalid"
  end

  scenario "Login with valid credentials" do
    sign_in
    within "h1" do
      page.should have_content "Blogs"
    end
  end

  scenario "Visit login page after logging in" do
    sign_in
    visit "/admin/login"
    within "h1" do
      page.should have_content "Blogs"
    end
  end

  scenario "User logs out" do
    sign_in
    click_link "Logout"
    page.should have_content "Please sign in"
  end

  scenario "Return to original page after logging in " do
    sign_in "/admin/grouped_blogs"
    current_url.should end_with "/admin/grouped_blogs"
  end

  def sign_in_with_invalid_email
    @user = create(:admin_user)
    visit "/admin"
    fill_in "Email", with: @user.email
    fill_in "Password", with: "wrongpass"
    click_button "Login"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
brightcontent-core-2.6.0 spec/features/login_spec.rb