Sha256: 643db2f22a580c2afee348550205e7bdf363463728d42a16c506164c5fa858a6

Contents?: true

Size: 769 Bytes

Versions: 3

Compression:

Stored size: 769 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Rating::Rate do
  let!(:object) { build :rating_rate }

  it { expect(object).to be_valid }

  it { is_expected.to belong_to :author }
  it { is_expected.to belong_to :resource }
  it { is_expected.to belong_to :scopeable }

  it { is_expected.to validate_presence_of :author }
  it { is_expected.to validate_presence_of :resource }
  it { is_expected.to validate_presence_of :value }

  it do
    is_expected.to validate_numericality_of(:value).is_less_than_or_equal_to(100).is_less_than_or_equal_to 100
  end

  it do
    expect(object).to validate_uniqueness_of(:author_id)
      .scoped_to(%i[author_type resource_id resource_type scopeable_id scopeable_type])
      .case_insensitive
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rating-0.5.0 spec/models/rate_spec.rb
rating-0.4.0 spec/models/rate_spec.rb
rating-0.3.0 spec/models/rate_spec.rb