Sha256: 8062f87517844e0d8ec4f440f6851423132d0509b241f904ce5e02afe8518d46

Contents?: true

Size: 874 Bytes

Versions: 4

Compression:

Stored size: 874 Bytes

Contents

# frozen_string_literal: true
require 'spec_helper'

describe Pinfirmable do
  it 'calls emailer after create' do
    expect(PinfirmableMailer)
      .to receive(:pin_email).with(an_instance_of(User))
      .and_return(double('PinfirmableMailer', deliver: true))

    u = User.new(
      email: 'test@example.com',
      password: 'password'
    )
    u.save
  end

  context "skip pinfirmation!" do
    it "doesn't call emailer" do
      expect(PinfirmableMailer)
        .not_to receive(:pin_email)
      u = User.new(
        email: 'test@example.com',
        password: 'password'
      )
      u.skip_pinfirmation!
      u.save
    end

    it "doesn't set the PIN" do
      u = User.new(
        email: 'test@example.com',
        password: 'password'
      )
      u.skip_pinfirmation!
      u.save
      expect(u.reload.pinfirmable_pin).to eq(nil)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pinfirmable-0.1.5 spec/models/pinfirmable_spec.rb
pinfirmable-0.1.4 spec/models/pinfirmable_spec.rb
pinfirmable-0.1.3 spec/models/pinfirmable_spec.rb
pinfirmable-0.1.2 spec/models/pinfirmable_spec.rb