Sha256: 2863f3a929381f08ad3516079f3bd77975ba1421e51d78e950ef8447440c546c

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe 'authentication' do
  context 'not logged in' do
    it 'redirects to login path' do
      visit outpost_people_path
      current_path.should eq outpost_login_path
    end
  end

  describe "logging in" do
    before :each do
      @user = create :user,
        :email                    => "bricker@kpcc.org",
        :password                 => "secret",
        :password_confirmation    => "secret"

      visit outpost_login_path
    end

    context 'incorrect login information' do
      it 'redirects back to login form' do
        fill_in "email", with: "nope@nope.nope"
        fill_in "password", with: "secret"
        click_button "Submit"

        current_path.should eq outpost_sessions_path
        page.should have_css ".alert-error"
      end
    end

    context "correct login information" do
      it 'logs the user in and redirects to dashboard' do
        fill_in "email", with: @user.email
        fill_in "password", with: "secret"
        click_button "Submit"

        current_path.should eq outpost_root_path
        page.should have_css ".alert-success"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
outpost-cms-0.0.5 spec/features/authentication_spec.rb
outpost-cms-0.0.4 spec/features/authentication_spec.rb