diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-07-04 20:08:41 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-07-04 20:08:41 +0300 |
commit | 2c78c7f4cdb1fae2650563f80feb294d2b7e5d80 (patch) | |
tree | a4c0d64344178d842c966a02ffb493480ffd49f8 /spec/models/concerns | |
parent | d453bb863593f7d5daab2a3e88ff1f18139d7eb1 (diff) |
Revert "Merge branch 'revert-12499' into 'master'"
This reverts merge request !12557
Diffstat (limited to 'spec/models/concerns')
-rw-r--r-- | spec/models/concerns/sortable_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/concerns/sortable_spec.rb b/spec/models/concerns/sortable_spec.rb new file mode 100644 index 00000000000..d1e17c4f684 --- /dev/null +++ b/spec/models/concerns/sortable_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe Sortable do + let(:relation) { Issue.all } + + describe '#where' do + it 'orders by id, descending' do + order_node = relation.where(iid: 1).order_values.first + expect(order_node).to be_a(Arel::Nodes::Descending) + expect(order_node.expr.name).to eq(:id) + end + end + + describe '#find_by' do + it 'does not order' do + expect(relation).to receive(:unscope).with(:order).and_call_original + + relation.find_by(iid: 1) + end + end +end |