about summary refs log tree commit diff
path: root/spec/models/rule_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/rule_spec.rb')
-rw-r--r--spec/models/rule_spec.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/models/rule_spec.rb b/spec/models/rule_spec.rb
index d5ec13ddf..c9b9c5502 100644
--- a/spec/models/rule_spec.rb
+++ b/spec/models/rule_spec.rb
@@ -2,6 +2,18 @@
 
 require 'rails_helper'
 
-RSpec.describe Rule, type: :model do
-  pending "add some examples to (or delete) #{__FILE__}"
+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