This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
2023-02-22 01:55:31 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-03-03 22:18:23 +01:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2023-03-04 17:16:45 +01:00
|
|
|
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
|
2019-03-03 22:18:23 +01:00
|
|
|
end
|