Sha256: 020b5ff46bae8563ccc8dcc86a5a50ba8ba9e0f8c21b6970d79d450ebd595b76
Contents?: true
Size: 1.21 KB
Versions: 5
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true require 'rails_helper' RSpec.describe Voting::Vote, ':vote_for' do let!(:author) { create :author } let!(:comment) { create :comment } context 'with no scopeable' do context 'when vote does not exist' do specify { expect(described_class.vote_for(author: author, resource: comment)).to eq nil } end context 'when vote does not exist' do before { create :voting_vote, author: author, resource: comment, positive: 1 } it 'returns the record' do expect(described_class.vote_for(author: author, resource: comment)).to eq described_class.last end end end context 'with scopeable' do let!(:category) { create :category } context 'when vote does not exist' do specify { expect(described_class.vote_for(author: author, resource: comment, scopeable: category)).to eq nil } end context 'when vote does not exist' do before { create :voting_vote, author: author, resource: comment, scopeable: category, positive: 1 } it 'returns the record' do query = described_class.vote_for(author: author, resource: comment, scopeable: category) expect(query).to eq described_class.last end end end end
Version data entries
5 entries across 5 versions & 1 rubygems