Sha256: 78107fd81e3425e9b063dec196efe7cb17a1a05417e3e38ac626024272fec714

Contents?: true

Size: 1.12 KB

Versions: 5

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

5 entries across 5 versions & 1 rubygems

Version Path
outpost-cms-0.1.4 spec/features/authentication_spec.rb
outpost-cms-0.1.3 spec/features/authentication_spec.rb
outpost-cms-0.1.2 spec/features/authentication_spec.rb
outpost-cms-0.1.1 spec/features/authentication_spec.rb
outpost-cms-0.1.0 spec/features/authentication_spec.rb