diff options
Diffstat (limited to 'spec/models/poll_spec.rb')
-rw-r--r-- | spec/models/poll_spec.rb | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/spec/models/poll_spec.rb b/spec/models/poll_spec.rb index 666f8ca68..8ae04ca41 100644 --- a/spec/models/poll_spec.rb +++ b/spec/models/poll_spec.rb @@ -1,5 +1,32 @@ +# frozen_string_literal: true + require 'rails_helper' -RSpec.describe Poll, type: :model do - pending "add some examples to (or delete) #{__FILE__}" +describe Poll do + describe 'scopes' do + let(:status) { Fabricate(:status) } + let(:attached_poll) { Fabricate(:poll, status: status) } + let(:not_attached_poll) do + Fabricate(:poll).tap do |poll| + poll.status = nil + poll.save(validate: false) + end + end + + describe 'attached' do + it 'finds the correct records' do + results = described_class.attached + + expect(results).to eq([attached_poll]) + end + end + + describe 'unattached' do + it 'finds the correct records' do + results = described_class.unattached + + expect(results).to eq([not_attached_poll]) + end + end + end end |