2017-10-30 01:44:23 +00:00
|
|
|
# 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 }
|
2017-11-02 18:55:46 +00:00
|
|
|
it { is_expected.to belong_to :scopeable }
|
2017-10-30 01:44:23 +00:00
|
|
|
|
|
|
|
it { is_expected.to validate_presence_of :author }
|
|
|
|
it { is_expected.to validate_presence_of :resource }
|
|
|
|
it { is_expected.to validate_presence_of :value }
|
|
|
|
|
2018-01-15 00:29:59 +00:00
|
|
|
it do
|
2017-10-30 01:44:23 +00:00
|
|
|
is_expected.to validate_numericality_of(:value).is_less_than_or_equal_to(100).is_less_than_or_equal_to 100
|
|
|
|
end
|
|
|
|
end
|