Skip to content
Snippets Groups Projects
Commit 70d743c7 authored by Sean Hill's avatar Sean Hill
Browse files

Add tests for custom distance and bearing columns.

parent 737801a3
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,24 @@ class NearTest < Test::Unit::TestCase ...@@ -35,6 +35,24 @@ class NearTest < Test::Unit::TestCase
assert_no_consecutive_comma(result[:select]) assert_no_consecutive_comma(result[:select])
end end
def test_near_scope_options_with_custom_distance_column
result = Event.send(:near_scope_options, 1.0, 2.0, 5, :distance_column => 'calculated_distance')
assert_no_match /AS distance/, result[:select]
assert_match /AS calculated_distance/, result[:select]
assert_no_match /\bdistance\b/, result[:order]
assert_match /calculated_distance/, result[:order]
assert_no_consecutive_comma(result[:select])
end
def test_near_scope_options_with_custom_bearing_column
result = Event.send(:near_scope_options, 1.0, 2.0, 5, :bearing_column => 'calculated_bearing')
assert_no_match /AS bearing/, result[:select]
assert_match /AS calculated_bearing/, result[:select]
assert_no_consecutive_comma(result[:select])
end
private private
def assert_no_consecutive_comma(string) def assert_no_consecutive_comma(string)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment