Sha256: ae4ce3514440384e6539baa2b70a69764b0ca008d78c8a1d0120e955e28e5c9a

Contents?: true

Size: 861 Bytes

Versions: 15

Compression:

Stored size: 861 Bytes

Contents

require "rails_helper"


RSpec.describe User, type: :model do

  it "should have a valid factores" do
    expect(create(:user)).to be_valid
  end

  it { is_expected.to respond_to :is_active }

  describe "default values" do
    it "default active value should be true" do
      @user = create(:user)
      expect(@user.is_active).to eq true
    end

    it 'should create a valid password upon creation' do
      user = create(:user, password: nil, password_confirmation: nil)
      expect(user).to be_persisted
    end

    it 'should not override choosen password' do
      user = create(:user, password: "totototo", password_confirmation: nil)
      expect(user.password).to eq "totototo"
    end

    it 'should send a welcome message upon creation' do
      expect { create(:user)}.to change(ActionMailer::Base.deliveries, :count).by(1)
    end
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dorsale-2.2.10 spec/models/dorsale/users_spec.rb
dorsale-2.2.9 spec/models/dorsale/users_spec.rb
dorsale-2.2.8 spec/models/dorsale/users_spec.rb
dorsale-2.2.6 spec/models/dorsale/users_spec.rb
dorsale-2.2.5 spec/models/dorsale/users_spec.rb
dorsale-2.2.4 spec/models/dorsale/users_spec.rb
dorsale-2.2.3 spec/models/dorsale/users_spec.rb
dorsale-2.2.2 spec/models/dorsale/users_spec.rb
dorsale-2.2.1 spec/models/dorsale/users_spec.rb
dorsale-2.2.0 spec/models/dorsale/users_spec.rb
dorsale-2.1.15 spec/models/dorsale/users_spec.rb
dorsale-2.1.14 spec/models/dorsale/users_spec.rb
dorsale-2.1.13 spec/models/dorsale/users_spec.rb
dorsale-2.1.12 spec/models/dorsale/users_spec.rb
dorsale-2.1.11 spec/models/dorsale/users_spec.rb