Sha256: 8c55113c78bd7657e75e13c60f753b57d180dc33e26b37a0eb89f96d4efaee70

Contents?: true

Size: 691 Bytes

Versions: 5

Compression:

Stored size: 691 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

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

  context 'with no scopeable' do
    it 'delegates to create method' do
      expect(Voting::Vote).to receive(:create).with author: author, resource: comment, scopeable: nil, value: -1

      author.down comment
    end
  end

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

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

      author.down 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/down_spec.rb
voting-0.4.0 spec/models/extension/down_spec.rb
voting-0.3.0 spec/models/extension/down_spec.rb
voting-0.2.0 spec/models/extension/down_spec.rb
voting-0.1.0 spec/models/extension/down_spec.rb