~cytrogen/masto-fe

ref: 3a679844e499df026be7d5b3a9e80e5bf3ad585a masto-fe/spec/models/poll_spec.rb -rw-r--r-- 715 bytes
3a679844 — Eugen Rochko Fix `account_id`, `max_id` and `min_id` params not working in search (#26847) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

require 'rails_helper'

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