Sha256: d39955789a45db1d8fae9902e533688a6b252653be064ec592b391c343cb00e1

Contents?: true

Size: 691 Bytes

Versions: 3

Compression:

Stored size: 691 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Voting::Extension, ':vote' 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(:create).with author: author, resource: comment, scopeable: nil, value: 1

      author.vote comment, 1
    end
  end

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

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

      author.vote comment, 1, scope: category
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
voting-0.3.0 spec/models/extension/vote_spec.rb
voting-0.2.0 spec/models/extension/vote_spec.rb
voting-0.1.0 spec/models/extension/vote_spec.rb