Sha256: f310a8f9e5021a15b3ca7ccb78a1f12827b2d6d48bc65403f1e5c242c589860b

Contents?: true

Size: 683 Bytes

Versions: 5

Compression:

Stored size: 683 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Voting::Extension, '.up' 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.up 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.up 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/up_spec.rb
voting-0.4.0 spec/models/extension/up_spec.rb
voting-0.3.0 spec/models/extension/up_spec.rb
voting-0.2.0 spec/models/extension/up_spec.rb
voting-0.1.0 spec/models/extension/up_spec.rb