Sha256: abb0e85b56ff421a1874308c01fea76fb990b995c157cc10c71bab188c6655e9

Contents?: true

Size: 681 Bytes

Versions: 5

Compression:

Stored size: 681 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Voting::Extension, ':vote_for' do
  let!(:author)  { create :author }
  let!(:comment) { create :comment }

  context 'with no scopeable' do
    it 'delegates to vote object' do
      expect(Voting::Vote).to receive(:vote_for).with author: author, resource: comment, scopeable: nil

      author.vote_for comment
    end
  end

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

    it 'delegates to vote object' do
      expect(Voting::Vote).to receive(:vote_for).with author: author, resource: comment, scopeable: category

      author.vote_for comment, scope: category
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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