2023-02-22 09:55:31 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-02-22 03:50:12 +09:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2024-09-04 14:12:25 +09:00
|
|
|
RSpec.describe Rule do
|
2023-03-05 01:16:45 +09:00
|
|
|
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
|
2021-02-22 03:50:12 +09:00
|
|
|
end
|