rule_spec.rb 513 B

12345678910111213141516171819
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe Rule do
  4. describe 'scopes' do
  5. describe 'ordered' do
  6. let(:deleted_rule) { Fabricate(:rule, deleted_at: 10.days.ago) }
  7. let(:first_rule) { Fabricate(:rule, deleted_at: nil, priority: 1) }
  8. let(:last_rule) { Fabricate(:rule, deleted_at: nil, priority: 10) }
  9. it 'finds the correct records' do
  10. results = described_class.ordered
  11. expect(results).to eq([first_rule, last_rule])
  12. end
  13. end
  14. end
  15. end