Sha256: 0449387a05a56bfacc127549120bee8ff8b90ac5e02021c538bf67fb5b8ae118

Contents?: true

Size: 689 Bytes

Versions: 9

Compression:

Stored size: 689 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

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

  it { expect(object).to be_valid }

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

  it { is_expected.to validate_presence_of :average }
  it { is_expected.to validate_presence_of :estimate }
  it { is_expected.to validate_presence_of :resource }
  it { is_expected.to validate_presence_of :sum }
  it { is_expected.to validate_presence_of :total }

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rating-0.11.0 spec/models/rating_spec.rb
rating-0.10.0 spec/models/rating_spec.rb
rating-0.9.0 spec/models/rating_spec.rb
rating-0.8.0 spec/models/rating_spec.rb
rating-0.7.0 spec/models/rating_spec.rb
rating-0.6.0 spec/models/rating_spec.rb
rating-0.5.0 spec/models/rating_spec.rb
rating-0.4.0 spec/models/rating_spec.rb
rating-0.3.0 spec/models/rating_spec.rb