Sha256: 0cd4bc02e85337d7e8ab641c9b8048283e643d1dd6f2c4022ea50fd772b3c639
Contents?: true
Size: 906 Bytes
Versions: 22
Compression:
Stored size: 906 Bytes
Contents
require "spec_helper" describe Clearance::Testing::ControllerHelpers do class TestClass include Clearance::Testing::ControllerHelpers def initialize @request = Class.new do def env { clearance: Clearance::Session.new({}) } end end.new end end describe "#sign_in" do it "creates an instance of the clearance user model with FactoryBot" do MyUserModel = Class.new allow(FactoryBot).to receive(:create) allow(Clearance.configuration).to receive(:user_model). and_return(MyUserModel) TestClass.new.sign_in expect(FactoryBot).to have_received(:create).with(:my_user_model) end end describe "#sign_in_as" do it "returns the user if signed in successfully" do user = build(:user) returned_user = TestClass.new.sign_in_as user expect(returned_user).to eq user end end end
Version data entries
22 entries across 22 versions & 1 rubygems