Skip to content

Commit

Permalink
Fixed sqlite tests [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Nov 18, 2020
1 parent 9c2cab0 commit 3e0421b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/percentile_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def test_even

def test_odd
skip if sqlite?

[15, 20, 35, 40, 50].each { |n| User.create!(visits_count: n) }
assert_equal 29, User.percentile(:visits_count, 0.4)
end
Expand All @@ -28,19 +29,21 @@ def test_one
end

def test_high
skip if sqlite?

[1, 1, 2, 3, 4, 100].each { |n| User.create!(visits_count: n) }
assert_in_delta 95.2, User.percentile(:visits_count, 0.99)
end

def test_expression
skip if mongoid?
skip if mongoid? || sqlite?

[1, 2, 3, 4].each { |n| User.create!(visits_count: n) }
assert_in_delta 4.25, User.percentile(Arel.sql("visits_count + 1"), 0.75)
end

def test_expression_no_arel
skip if mongoid?
skip if mongoid? || sqlite?

message = "[active_median] Non-attribute argument: visits_count + 1. Use Arel.sql() for known-safe values. This will raise an error in ActiveMedian 0.3.0\n"
_, stderr = capture_io do
Expand Down

0 comments on commit 3e0421b

Please sign in to comment.