Sha256: 0fb744674170836fe4f4c735e9e6619e519420f64a58316d7db61a2909b5a4ca

Contents?: true

Size: 681 Bytes

Versions: 4

Compression:

Stored size: 681 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Rating::Extension, ':rate_for' do
  let!(:author)  { create :author }
  let!(:article) { create :article }

  context 'with no scopeable' do
    it 'delegates to rate object' do
      expect(Rating::Rate).to receive(:rate_for).with author: author, resource: article, scopeable: nil

      author.rate_for article
    end
  end

  context 'with scopeable' do
    let!(:category) { build :category }

    it 'delegates to rate object' do
      expect(Rating::Rate).to receive(:rate_for).with author: author, resource: article, scopeable: category

      author.rate_for article, scope: category
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rating-0.6.0 spec/models/extension/rate_for_spec.rb
rating-0.5.0 spec/models/extension/rate_for_spec.rb
rating-0.4.0 spec/models/extension/rate_for_spec.rb
rating-0.3.0 spec/models/extension/rate_for_spec.rb