Sha256: 00ef227d76d783d388bb43ca587d1d9397250eda397872ae6441b090b3b68d12
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
require 'rails_helper' # DoorkeeperSsoClient::Mixins::ControllerHelpers automatically included into Devise::Controller::Helpers RSpec.describe "DoorkeeperSsoClient::Mixins::ControllerHelpers", :type => :controller do controller(ApplicationController) do devise_group :sso, contains: [:user] before_filter :authenticate_user! before_filter :validate_passport! def index render nothing: :true end end let(:user) { Fabricate(:user) } let(:passport) { Fabricate(:passport, identity: user) } describe "before_filter#validate_passport!" do context "when user is logged in" do before(:each) do @request.env["devise.mapping"] = Devise.mappings[:user] sign_in user get :index end context "with valid passport" do it "remain signed in" do expect(controller.user_signed_in?).to be_truthy end end end context "when user is logged out" do let(:passport) { Fabricate(:passport, identity: user, revoked_at: Time.now, revoke_reason: :logout ) } it "log out user" do expect(controller.user_signed_in?).to be_falsey end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
doorkeeper_sso_client-0.2.5 | spec/lib/doorkeeper_sso_client/mixins/controller_helper_spec.rb |