Sha256: 31400a86316c8e812de2a1ef58fb3f0732aff2c0efe65e1996c5f8899141ab47

Contents?: true

Size: 852 Bytes

Versions: 5

Compression:

Stored size: 852 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Voting::Voting do
  let!(:object) { build :voting_voting }

  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 :estimate }
  it { is_expected.to validate_presence_of :negative }
  it { is_expected.to validate_presence_of :positive }
  it { is_expected.to validate_presence_of :resource }

  it { is_expected.to validate_numericality_of(:negative).is_greater_than_or_equal_to(0).only_integer }
  it { is_expected.to validate_numericality_of(:positive).is_greater_than_or_equal_to(0).only_integer }

  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

5 entries across 5 versions & 1 rubygems

Version Path
voting-0.5.0 spec/models/voting_spec.rb
voting-0.4.0 spec/models/voting_spec.rb
voting-0.3.0 spec/models/voting_spec.rb
voting-0.2.0 spec/models/voting_spec.rb
voting-0.1.0 spec/models/voting_spec.rb