diff options
author | Matt Jankowski <matt@jankowski.online> | 2023-03-04 11:16:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-04 17:16:45 +0100 |
commit | 506b16cf595bf441b9a85db608b6d19e8934fd7d (patch) | |
tree | b3e2a2ef9f519e5298539c684631be6c2726d817 /spec/models/poll_spec.rb | |
parent | 7f4412eeeb1d35c9345c213b2cdfbbb9ce97dabb (diff) |
Pending example models minimal coverage (#23912)
Diffstat (limited to 'spec/models/poll_spec.rb')
-rw-r--r-- | spec/models/poll_spec.rb | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/spec/models/poll_spec.rb b/spec/models/poll_spec.rb index 474399bf6..8ae04ca41 100644 --- a/spec/models/poll_spec.rb +++ b/spec/models/poll_spec.rb @@ -2,6 +2,31 @@ 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 |