Sha256: 503beed63c79d665b2d3149b77350f9265446aa020eaadbe212dcca0588cfcd7

Contents?: true

Size: 840 Bytes

Versions: 33

Compression:

Stored size: 840 Bytes

Contents

require "spec_helper"

describe Clearance::Testing::ViewHelpers do
  describe "#sign_in" do
    it "sets the signed in user to a new user object" do
      user_model = Class.new
      allow(Clearance.configuration).to receive(:user_model).
        and_return(user_model)

      view = test_view_class.new
      view.sign_in

      expect(view.current_user).to be_an_instance_of(user_model)
    end
  end

  describe "#sign_in_as" do
    it "sets the signed in user to the object provided" do
      user = double("User")

      view = test_view_class.new
      view.sign_in_as(user)

      expect(view.current_user).to eq user
    end
  end

  def test_view_class
    Class.new do
      include Clearance::Testing::ViewHelpers

      def view
        @view ||= extend Clearance::Testing::ViewHelpers::CurrentUser
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
clearance-2.9.3 spec/clearance/testing/view_helpers_spec.rb
clearance-2.9.2 spec/clearance/testing/view_helpers_spec.rb
clearance-2.9.1 spec/clearance/testing/view_helpers_spec.rb
clearance-2.9.0 spec/clearance/testing/view_helpers_spec.rb
clearance-2.8.0 spec/clearance/testing/view_helpers_spec.rb
clearance-2.7.2 spec/clearance/testing/view_helpers_spec.rb
clearance-2.7.0 spec/clearance/testing/view_helpers_spec.rb
clearance-2.6.2 spec/clearance/testing/view_helpers_spec.rb
clearance-2.6.1 spec/clearance/testing/view_helpers_spec.rb
clearance-2.6.0 spec/clearance/testing/view_helpers_spec.rb
clearance-2.5.0 spec/clearance/testing/view_helpers_spec.rb
clearance-2.4.0 spec/clearance/testing/view_helpers_spec.rb
clearance-2.3.1 spec/clearance/testing/view_helpers_spec.rb
clearance-2.3.0 spec/clearance/testing/view_helpers_spec.rb
clearance-2.2.1 spec/clearance/testing/view_helpers_spec.rb
clearance-2.2.0 spec/clearance/testing/view_helpers_spec.rb
clearance-2.1.0 spec/clearance/testing/view_helpers_spec.rb
clearance-2.0.0 spec/clearance/testing/view_helpers_spec.rb
clearance-2.0.0.beta2 spec/clearance/testing/view_helpers_spec.rb
clearance-2.0.0.beta1 spec/clearance/testing/view_helpers_spec.rb