Sha256: 4c787bfe38b643a68a0f911dc195e625c990c868462e8eb42163d9ad656a7f4b

Contents?: true

Size: 633 Bytes

Versions: 7

Compression:

Stored size: 633 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe User, type: :model do
  describe 'validations' do
    context 'with email' do
      it { is_expected.to validate_presence_of(:email) }
      it { is_expected.to validate_length_of(:email).is_at_least(5).is_at_most(255) }
      # it { is_expected.to validate_uniqueness_of(:email).case_insensitive }
    end

    context 'with roles' do
      it { is_expected.to define_enum_for(:role).with(described_class.roles.keys) }
    end

    context 'with associations' do
      it { is_expected.to have_many(:login_activities).order(created_at: :desc) }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kowl-0.0.7 lib/kowl/templates/tests/rspec/models/user_spec.rb
kowl-0.0.6 lib/kowl/templates/tests/rspec/models/user_spec.rb
kowl-0.0.5 lib/kowl/templates/tests/rspec/models/user_spec.rb
kowl-0.0.4 lib/kowl/templates/tests/rspec/models/user_spec.rb
kowl-0.0.3 lib/kowl/templates/tests/rspec/models/user_spec.rb
kowl-0.0.2 lib/kowl/templates/tests/rspec/models/user_spec.rb
kowl-0.0.1 lib/kowl/templates/tests/rspec/models/user_spec.rb