Sha256: 783d17d0e8f879870d67081d1c6157d586cf50d640b5cf2dd6e148680817e20b

Contents?: true

Size: 1.25 KB

Versions: 12

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

if defined?(Devise)
  describe "A decorator spec" do
    it "can sign in a real user" do
      user = User.new
      sign_in user

      expect(helper.current_user).to be user
    end

    it "can sign in a mock user" do
      user = double("User")
      sign_in :user, user

      expect(helper.current_user).to be user
    end

    it "can sign in a real admin" do
      admin = Admin.new
      sign_in admin

      expect(helper.current_admin).to be admin
    end

    it "can sign in a mock admin" do
      admin = double("Admin")
      sign_in :admin, admin

      expect(helper.current_admin).to be admin
    end

    it "can sign out a real user" do
      user = User.new
      sign_in user
      sign_out user

      expect(helper.current_user).to be_nil
    end

    it "can sign out a mock user" do
      user = double("User")
      sign_in :user, user
      sign_out :user

      expect(helper.current_user).to be_nil
    end

    it "can sign out without a user" do
      sign_out :user

      expect(helper.current_user).to be_nil
    end

    it "is backwards-compatible" do
      user = double("User")
      ActiveSupport::Deprecation.silence do
        sign_in user
      end

      expect(helper.current_user).to be user
    end
  end
end

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
draper-3.0.0.pre1 spec/dummy/spec/decorators/devise_spec.rb
draper_new-3.0.0 spec/dummy/spec/decorators/devise_spec.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/draper-2.1.0/spec/dummy/spec/decorators/devise_spec.rb
draper-2.1.0 spec/dummy/spec/decorators/devise_spec.rb
draper-2.0.0 spec/dummy/spec/decorators/devise_spec.rb
draper-1.4.0 spec/dummy/spec/decorators/devise_spec.rb
draper-1.3.1 spec/dummy/spec/decorators/devise_spec.rb
draper-1.3.0 spec/dummy/spec/decorators/devise_spec.rb
draper-1.2.1 spec/dummy/spec/decorators/devise_spec.rb
draper-1.2.0 spec/dummy/spec/decorators/devise_spec.rb
jamesgolick-draper-1.1.1a spec/dummy/spec/decorators/devise_spec.rb
draper-1.1.0 spec/dummy/spec/decorators/devise_spec.rb