Skip to content

Commit

Permalink
mac specific tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrock committed Aug 10, 2017
1 parent 5427aec commit e08b4e1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/concerns/scopes_test.rb
Expand Up @@ -31,7 +31,12 @@ def test_scopes

def test_order_by
AncestryTestDatabase.with_model :depth => 3, :width => 3 do |model, roots|
expected = model.all.sort_by { |m| [m.ancestry || "", m.id.to_i] }
# not thrilled with this. mac postgres has odd sorting requirements
if ENV["BUNDLE_GEMFILE"].to_s =~ /pg/ && RUBY_PLATFORM != "x86_64-darwin16"
expected = model.all.sort_by { |m| [m.ancestry.to_s.gsub('/',''), m.id.to_i] }
else
expected = model.all.sort_by { |m| [m.ancestry.to_s, m.id.to_i] }
end
actual = model.ordered_by_ancestry_and(:id)
assert_equal expected.map { |r| [r.ancestry, r.id.to_s] }, actual.map { |r| [r.ancestry, r.id.to_s] }
end
Expand Down

0 comments on commit e08b4e1

Please sign in to comment.