1
0

poll_spec.rb 715 B

1234567891011121314151617181920212223242526272829303132
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe Poll do
  4. describe 'scopes' do
  5. let(:status) { Fabricate(:status) }
  6. let(:attached_poll) { Fabricate(:poll, status: status) }
  7. let(:not_attached_poll) do
  8. Fabricate(:poll).tap do |poll|
  9. poll.status = nil
  10. poll.save(validate: false)
  11. end
  12. end
  13. describe 'attached' do
  14. it 'finds the correct records' do
  15. results = described_class.attached
  16. expect(results).to eq([attached_poll])
  17. end
  18. end
  19. describe 'unattached' do
  20. it 'finds the correct records' do
  21. results = described_class.unattached
  22. expect(results).to eq([not_attached_poll])
  23. end
  24. end
  25. end
  26. end