Sha256: 82882a72c370b5fd42975b29574adadca51163d5855c2c7b99d4dfb7fad6ef04

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

describe "Session", :vcr, :record => :new_episodes, :type => :request do

  context "successful login" do
    before { setup_for_github_login }

    it "enforces opensesame login" do
      visit root_path
      within("#opensesame-session") do
        page.should have_content("Login")
        click_link "github"
      end

      page.should have_content "Welcome Home"
    end

    describe "auto login" do
      before { OpenSesame.stub!(:auto_access_provider).and_return('github') }

      it "allows auto login" do
        visit root_path
        page.should have_content "Welcome Home"
      end

      it "skips auto login if just logged out" do
        visit root_path

        click_link "Logout"

        page.should_not have_content "Welcome Home"
        page.should have_content "Login"

        visit root_path  # auto login now works on refresh
        page.should have_content "Welcome Home"
        page.should_not have_content "Login"
      end
    end
  end

  it "tries auto login and ends up on opensesame page after failure" do
    setup_for_github_login(mock('NonUser', :id => "123"))
    visit root_path
    page.should have_content "Login"
    page.should_not have_content "Welcome Home"
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opensesame-0.1.2 spec/lib/open_sesame/sessions_spec.rb
opensesame-0.1.1 spec/lib/open_sesame/sessions_spec.rb
opensesame-0.1.0 spec/lib/open_sesame/sessions_spec.rb