Sha256: 9617e209712d4ed5e9d0b10f436f3859245eb165bb0bccd5ed4bbba33bdb8cd0

Contents?: true

Size: 558 Bytes

Versions: 1

Compression:

Stored size: 558 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Rating::Extension, ':rated?' do
  let!(:user)    { create :user }
  let!(:article) { create :article }

  context 'when has no rate for the given resource' do
    before { allow(user).to receive(:rate_for).with(article) { nil } }

    specify { expect(user.rated?(article)).to eq false }
  end

  context 'when has rate for the given resource' do
    before { allow(user).to receive(:rate_for).with(article) { double } }

    specify { expect(user.rated?(article)).to eq true }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rating-0.1.0 spec/models/extension/rated_question_spec.rb