Move common query time condition to mixin
This commit is contained in:
parent
989b110bfc
commit
500c1bddf2
4 changed files with 67 additions and 51 deletions
|
@ -1068,6 +1068,29 @@ module Api
|
|||
end
|
||||
end
|
||||
|
||||
def test_search_by_time_success
|
||||
note1 = create(:note, :created_at => "2020-02-01T00:00:00Z", :updated_at => "2020-04-01T00:00:00Z")
|
||||
note2 = create(:note, :created_at => "2020-03-01T00:00:00Z", :updated_at => "2020-05-01T00:00:00Z")
|
||||
|
||||
get search_api_notes_path(:from => "2020-02-15T00:00:00Z", :to => "2020-04-15T00:00:00Z", :format => "xml")
|
||||
assert_response :success
|
||||
assert_equal "application/xml", @response.media_type
|
||||
assert_select "osm", :count => 1 do
|
||||
assert_select "note", :count => 1 do
|
||||
assert_select "id", note2.id.to_s
|
||||
end
|
||||
end
|
||||
|
||||
get search_api_notes_path(:from => "2020-02-15T00:00:00Z", :to => "2020-04-15T00:00:00Z", :sort => "updated_at", :format => "xml")
|
||||
assert_response :success
|
||||
assert_equal "application/xml", @response.media_type
|
||||
assert_select "osm", :count => 1 do
|
||||
assert_select "note", :count => 1 do
|
||||
assert_select "id", note1.id.to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_search_by_bbox_success
|
||||
notes = Array.new(5) do |i|
|
||||
position = ((1.0 + (i * 0.1)) * GeoRecord::SCALE).to_i
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue