Sha256: c9c5984df202f1725404050636a40658b264cf243a5df5197fbaf60c35b2f9cb
Contents?: true
Size: 896 Bytes
Versions: 1
Compression:
Stored size: 896 Bytes
Contents
# frozen_string_literal: true require 'rails_helper' require 'support/shared_context/with_database_records' RSpec.describe Rating::Rating, ':update_rating' do include_context 'with_database_records' context 'with no scopeable' do it 'updates the rating data of the given resource' do record = described_class.find_by(resource: article_1) expect(record.average).to eq 50.5 expect(record.estimate).to eq 42.5 expect(record.sum).to eq 101 expect(record.total).to eq 2 end end context 'with scopeable' do it 'updates the rating data of the given resource respecting the scope' do record = described_class.find_by(resource: article_1, scopeable: category) expect(record.average).to eq 1.5 expect(record.estimate).to eq 1.5 expect(record.sum).to eq 3 expect(record.total).to eq 2 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rating-0.4.0 | spec/models/rating/update_rating_spec.rb |