Sha256: 10c888c26143403b201a8f73fad4479d85fc2c8a50ded8812ec0fd6c40738e88
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true RSpec.describe "textual order" do it "randomly selects from shelves ordered by textual id asc" do expect(Shelf.order("shelf_id ASC").to_sql).to end_with("ORDER BY shelf_id ASC, RANDOM()") end it "randomly selects from shelves ordered by fully qualified textual id asc" do expect(Shelf.order('"shelves"."shelf_id"').to_sql).to end_with('ORDER BY "shelves"."shelf_id", RANDOM()') end it "randomly selects from shelves ordered by textual position asc" do expect(Shelf.order("shelf_position ASC").to_sql).to end_with("ORDER BY shelf_position ASC, RANDOM()") end it "randomly selects from shelves ordered by textual id desc" do expect(Shelf.order("shelf_id DESC").to_sql).to end_with("ORDER BY shelf_id DESC, RANDOM()") end it "randomly selects from shelves ordered by textual position desc" do expect(Shelf.order("shelf_position DESC").to_sql).to end_with("ORDER BY shelf_position DESC, RANDOM()") end it "randomly selects from shelves ordered by textual id and position asc" do expect(Shelf.order("shelf_id ASC, shelf_position ASC").to_sql).to end_with( "ORDER BY shelf_id ASC, shelf_position ASC, RANDOM()" ) end it "randomly selects from shelves ordered by textual id and position desc" do expect(Shelf.order("shelf_id DESC, shelf_position DESC").to_sql).to end_with( "ORDER BY shelf_id DESC, shelf_position DESC, RANDOM()" ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
unreliable-0.9.1 | spec/textual_order_spec.rb |
unreliable-0.9.0 | spec/textual_order_spec.rb |