From e08b4e1ddbcbfe6e5900e1d52a913955f4f7c0a4 Mon Sep 17 00:00:00 2001 From: Keenan Brock Date: Thu, 10 Aug 2017 14:17:21 -0400 Subject: [PATCH] mac specific tests --- test/concerns/scopes_test.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/concerns/scopes_test.rb b/test/concerns/scopes_test.rb index d12ad1fc..dd7093aa 100644 --- a/test/concerns/scopes_test.rb +++ b/test/concerns/scopes_test.rb @@ -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