Sha256: 0ec2d440329d23abbe23d68dd186697068feb526b478c61575890eaa4c69d6e7

Contents?: true

Size: 919 Bytes

Versions: 9

Compression:

Stored size: 919 Bytes

Contents

describe SessionsController, :omniauth do

  before do
    request.env['omniauth.auth'] = auth_mock
  end

  describe "#create" do

    it "creates a user" do
      expect {post :create, provider: :twitter}.to change{ User.count }.by(1)
    end

    it "creates a session" do
      expect(session[:user_id]).to be_nil
      post :create, provider: :twitter
      expect(session[:user_id]).not_to be_nil
    end

    it "redirects to the home page" do
      post :create, provider: :twitter
      expect(response).to redirect_to root_url
    end

  end

  describe "#destroy" do

    before do
      post :create, provider: :twitter
    end

    it "resets the session" do
      expect(session[:user_id]).not_to be_nil
      delete :destroy
      expect(session[:user_id]).to be_nil
    end

    it "redirects to the home page" do
      delete :destroy
      expect(response).to redirect_to root_url
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rails_apps_testing-0.3.13 lib/generators/testing/configure/templates/spec/omniauth/controllers/sessions_controller_spec.rb
rails_apps_testing-0.3.12 lib/generators/testing/configure/templates/spec/omniauth/controllers/sessions_controller_spec.rb
rails_apps_testing-0.3.11 lib/generators/testing/configure/templates/spec/omniauth/controllers/sessions_controller_spec.rb
rails_apps_testing-0.3.10 lib/generators/testing/configure/templates/spec/omniauth/controllers/sessions_controller_spec.rb
rails_apps_testing-0.3.9 lib/generators/testing/configure/templates/spec/omniauth/controllers/sessions_controller_spec.rb
rails_apps_testing-0.3.8 lib/generators/testing/configure/templates/spec/omniauth/controllers/sessions_controller_spec.rb
rails_apps_testing-0.3.7 lib/generators/testing/configure/templates/spec/omniauth/controllers/sessions_controller_spec.rb
rails_apps_testing-0.3.6 lib/generators/testing/configure/templates/spec/omniauth/controllers/sessions_controller_spec.rb
rails_apps_testing-0.3.5 lib/generators/testing/configure/templates/spec/omniauth/controllers/sessions_controller_spec.rb