about summary refs log tree commit diff
path: root/spec/models/rule_spec.rb
blob: c9b9c55028f366b4a7408ec4a7e59c06d170bc68 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

require 'rails_helper'

describe Rule do
  describe 'scopes' do
    describe 'ordered' do
      let(:deleted_rule) { Fabricate(:rule, deleted_at: 10.days.ago) }
      let(:first_rule) { Fabricate(:rule, deleted_at: nil, priority: 1) }
      let(:last_rule) { Fabricate(:rule, deleted_at: nil, priority: 10) }

      it 'finds the correct records' do
        results = described_class.ordered

        expect(results).to eq([first_rule, last_rule])
      end
    end
  end
end