Sha256: fb5d7c8e0827a51f2d963c1cacace3d73af81895bad2eff73cb716025f2f4496

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

require 'minitest_helper'

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

      assert_same user, helper.current_user
    end

    it "can sign in a mock user" do
      user = Object.new
      sign_in :user, user

      assert_same user, helper.current_user
    end

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

      assert_same admin, helper.current_admin
    end

    it "can sign in a mock admin" do
      admin = Object.new
      sign_in :admin, admin

      assert_same admin, helper.current_admin
    end

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

      assert helper.current_user.nil?
    end

    it "can sign out a mock user" do
      user = Object.new
      sign_in :user, user
      sign_out :user

      assert helper.current_user.nil?
    end

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

      assert helper.current_user.nil?
    end

    it "is backwards-compatible" do
      user = Object.new
      ActiveSupport::Deprecation.silence do
        sign_in user
      end

      assert_same user, helper.current_user
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
strong_presenter-0.2.2 spec/dummy/test/presenters/minitest/devise_test.rb
strong_presenter-0.2.1 spec/dummy/test/presenters/minitest/devise_test.rb
strong_presenter-0.2.0 spec/dummy/test/presenters/minitest/devise_test.rb
strong_presenter-0.1.0 spec/dummy/test/presenters/minitest/devise_test.rb