Fix some deprecation warnings
This commit is contained in:
parent
22cd2314e5
commit
1f4d48eaf3
10 changed files with 74 additions and 72 deletions
|
@ -1,6 +1,8 @@
|
||||||
class Notifier < ActionMailer::Base
|
class Notifier < ActionMailer::Base
|
||||||
include ActionView::Helpers::AssetUrlHelper
|
include ActionView::Helpers::AssetUrlHelper
|
||||||
|
|
||||||
|
self.delivery_job = ActionMailer::MailDeliveryJob
|
||||||
|
|
||||||
default :from => Settings.email_from,
|
default :from => Settings.email_from,
|
||||||
:return_path => Settings.email_return_path,
|
:return_path => Settings.email_return_path,
|
||||||
:auto_submitted => "auto-generated"
|
:auto_submitted => "auto-generated"
|
||||||
|
|
|
@ -4,7 +4,7 @@ module Redactable
|
||||||
def self.included(base)
|
def self.included(base)
|
||||||
# this is used to extend activerecord bases, as these aren't
|
# this is used to extend activerecord bases, as these aren't
|
||||||
# in scope for the module itself.
|
# in scope for the module itself.
|
||||||
base.scope :unredacted, -> { base.where(:redaction_id => nil) }
|
base.scope :unredacted, -> { where(:redaction_id => nil) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def redacted?
|
def redacted?
|
||||||
|
|
|
@ -479,7 +479,7 @@ module Api
|
||||||
|
|
||||||
get :show, :params => { :id => open_note.id, :format => "xml" }
|
get :show, :params => { :id => open_note.id, :format => "xml" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/xml", @response.content_type
|
assert_equal "application/xml", @response.media_type
|
||||||
assert_select "osm", :count => 1 do
|
assert_select "osm", :count => 1 do
|
||||||
assert_select "note[lat='#{open_note.lat}'][lon='#{open_note.lon}']", :count => 1 do
|
assert_select "note[lat='#{open_note.lat}'][lon='#{open_note.lon}']", :count => 1 do
|
||||||
assert_select "id", open_note.id.to_s
|
assert_select "id", open_note.id.to_s
|
||||||
|
@ -496,7 +496,7 @@ module Api
|
||||||
|
|
||||||
get :show, :params => { :id => open_note.id, :format => "rss" }
|
get :show, :params => { :id => open_note.id, :format => "rss" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "item", :count => 1 do
|
assert_select "item", :count => 1 do
|
||||||
|
@ -512,7 +512,7 @@ module Api
|
||||||
|
|
||||||
get :show, :params => { :id => open_note.id, :format => "json" }
|
get :show, :params => { :id => open_note.id, :format => "json" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
js = ActiveSupport::JSON.decode(@response.body)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
assert_equal "Feature", js["type"]
|
assert_equal "Feature", js["type"]
|
||||||
|
@ -528,7 +528,7 @@ module Api
|
||||||
|
|
||||||
get :show, :params => { :id => open_note.id, :format => "gpx" }
|
get :show, :params => { :id => open_note.id, :format => "gpx" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/gpx+xml", @response.content_type
|
assert_equal "application/gpx+xml", @response.media_type
|
||||||
assert_select "gpx", :count => 1 do
|
assert_select "gpx", :count => 1 do
|
||||||
assert_select "wpt[lat='#{open_note.lat}'][lon='#{open_note.lon}']", :count => 1 do
|
assert_select "wpt[lat='#{open_note.lat}'][lon='#{open_note.lon}']", :count => 1 do
|
||||||
assert_select "time", :count => 1
|
assert_select "time", :count => 1
|
||||||
|
@ -636,7 +636,7 @@ module Api
|
||||||
|
|
||||||
get :index, :params => { :bbox => "1,1,1.2,1.2", :format => "rss" }
|
get :index, :params => { :bbox => "1,1,1.2,1.2", :format => "rss" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "item", :count => 2
|
assert_select "item", :count => 2
|
||||||
|
@ -645,7 +645,7 @@ module Api
|
||||||
|
|
||||||
get :index, :params => { :bbox => "1,1,1.2,1.2", :format => "json" }
|
get :index, :params => { :bbox => "1,1,1.2,1.2", :format => "json" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
js = ActiveSupport::JSON.decode(@response.body)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
assert_equal "FeatureCollection", js["type"]
|
assert_equal "FeatureCollection", js["type"]
|
||||||
|
@ -653,14 +653,14 @@ module Api
|
||||||
|
|
||||||
get :index, :params => { :bbox => "1,1,1.2,1.2", :format => "xml" }
|
get :index, :params => { :bbox => "1,1,1.2,1.2", :format => "xml" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/xml", @response.content_type
|
assert_equal "application/xml", @response.media_type
|
||||||
assert_select "osm", :count => 1 do
|
assert_select "osm", :count => 1 do
|
||||||
assert_select "note", :count => 2
|
assert_select "note", :count => 2
|
||||||
end
|
end
|
||||||
|
|
||||||
get :index, :params => { :bbox => "1,1,1.2,1.2", :format => "gpx" }
|
get :index, :params => { :bbox => "1,1,1.2,1.2", :format => "gpx" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/gpx+xml", @response.content_type
|
assert_equal "application/gpx+xml", @response.media_type
|
||||||
assert_select "gpx", :count => 1 do
|
assert_select "gpx", :count => 1 do
|
||||||
assert_select "wpt", :count => 2
|
assert_select "wpt", :count => 2
|
||||||
end
|
end
|
||||||
|
@ -673,7 +673,7 @@ module Api
|
||||||
|
|
||||||
get :index, :params => { :bbox => "1,1,1.2,1.2", :limit => 1, :format => "rss" }
|
get :index, :params => { :bbox => "1,1,1.2,1.2", :limit => 1, :format => "rss" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "item", :count => 1
|
assert_select "item", :count => 1
|
||||||
|
@ -682,7 +682,7 @@ module Api
|
||||||
|
|
||||||
get :index, :params => { :bbox => "1,1,1.2,1.2", :limit => 1, :format => "json" }
|
get :index, :params => { :bbox => "1,1,1.2,1.2", :limit => 1, :format => "json" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
js = ActiveSupport::JSON.decode(@response.body)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
assert_equal "FeatureCollection", js["type"]
|
assert_equal "FeatureCollection", js["type"]
|
||||||
|
@ -690,14 +690,14 @@ module Api
|
||||||
|
|
||||||
get :index, :params => { :bbox => "1,1,1.2,1.2", :limit => 1, :format => "xml" }
|
get :index, :params => { :bbox => "1,1,1.2,1.2", :limit => 1, :format => "xml" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/xml", @response.content_type
|
assert_equal "application/xml", @response.media_type
|
||||||
assert_select "osm", :count => 1 do
|
assert_select "osm", :count => 1 do
|
||||||
assert_select "note", :count => 1
|
assert_select "note", :count => 1
|
||||||
end
|
end
|
||||||
|
|
||||||
get :index, :params => { :bbox => "1,1,1.2,1.2", :limit => 1, :format => "gpx" }
|
get :index, :params => { :bbox => "1,1,1.2,1.2", :limit => 1, :format => "gpx" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/gpx+xml", @response.content_type
|
assert_equal "application/gpx+xml", @response.media_type
|
||||||
assert_select "gpx", :count => 1 do
|
assert_select "gpx", :count => 1 do
|
||||||
assert_select "wpt", :count => 1
|
assert_select "wpt", :count => 1
|
||||||
end
|
end
|
||||||
|
@ -706,7 +706,7 @@ module Api
|
||||||
def test_index_empty_area
|
def test_index_empty_area
|
||||||
get :index, :params => { :bbox => "5,5,5.1,5.1", :format => "rss" }
|
get :index, :params => { :bbox => "5,5,5.1,5.1", :format => "rss" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "item", :count => 0
|
assert_select "item", :count => 0
|
||||||
|
@ -715,7 +715,7 @@ module Api
|
||||||
|
|
||||||
get :index, :params => { :bbox => "5,5,5.1,5.1", :format => "json" }
|
get :index, :params => { :bbox => "5,5,5.1,5.1", :format => "json" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
js = ActiveSupport::JSON.decode(@response.body)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
assert_equal "FeatureCollection", js["type"]
|
assert_equal "FeatureCollection", js["type"]
|
||||||
|
@ -723,14 +723,14 @@ module Api
|
||||||
|
|
||||||
get :index, :params => { :bbox => "5,5,5.1,5.1", :format => "xml" }
|
get :index, :params => { :bbox => "5,5,5.1,5.1", :format => "xml" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/xml", @response.content_type
|
assert_equal "application/xml", @response.media_type
|
||||||
assert_select "osm", :count => 1 do
|
assert_select "osm", :count => 1 do
|
||||||
assert_select "note", :count => 0
|
assert_select "note", :count => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
get :index, :params => { :bbox => "5,5,5.1,5.1", :format => "gpx" }
|
get :index, :params => { :bbox => "5,5,5.1,5.1", :format => "gpx" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/gpx+xml", @response.content_type
|
assert_equal "application/gpx+xml", @response.media_type
|
||||||
assert_select "gpx", :count => 1 do
|
assert_select "gpx", :count => 1 do
|
||||||
assert_select "wpt", :count => 0
|
assert_select "wpt", :count => 0
|
||||||
end
|
end
|
||||||
|
@ -739,19 +739,19 @@ module Api
|
||||||
def test_index_large_area
|
def test_index_large_area
|
||||||
get :index, :params => { :bbox => "-2.5,-2.5,2.5,2.5", :format => :json }
|
get :index, :params => { :bbox => "-2.5,-2.5,2.5,2.5", :format => :json }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
|
|
||||||
get :index, :params => { :l => "-2.5", :b => "-2.5", :r => "2.5", :t => "2.5", :format => :json }
|
get :index, :params => { :l => "-2.5", :b => "-2.5", :r => "2.5", :t => "2.5", :format => :json }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
|
|
||||||
get :index, :params => { :bbox => "-10,-10,12,12", :format => :json }
|
get :index, :params => { :bbox => "-10,-10,12,12", :format => :json }
|
||||||
assert_response :bad_request
|
assert_response :bad_request
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
|
|
||||||
get :index, :params => { :l => "-10", :b => "-10", :r => "12", :t => "12", :format => :json }
|
get :index, :params => { :l => "-10", :b => "-10", :r => "12", :t => "12", :format => :json }
|
||||||
assert_response :bad_request
|
assert_response :bad_request
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_index_closed
|
def test_index_closed
|
||||||
|
@ -763,7 +763,7 @@ module Api
|
||||||
# Open notes + closed in last 7 days
|
# Open notes + closed in last 7 days
|
||||||
get :index, :params => { :bbox => "1,1,1.7,1.7", :closed => "7", :format => "json" }
|
get :index, :params => { :bbox => "1,1,1.7,1.7", :closed => "7", :format => "json" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
js = ActiveSupport::JSON.decode(@response.body)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
assert_equal "FeatureCollection", js["type"]
|
assert_equal "FeatureCollection", js["type"]
|
||||||
|
@ -772,7 +772,7 @@ module Api
|
||||||
# Only open notes
|
# Only open notes
|
||||||
get :index, :params => { :bbox => "1,1,1.7,1.7", :closed => "0", :format => "json" }
|
get :index, :params => { :bbox => "1,1,1.7,1.7", :closed => "0", :format => "json" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
js = ActiveSupport::JSON.decode(@response.body)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
assert_equal "FeatureCollection", js["type"]
|
assert_equal "FeatureCollection", js["type"]
|
||||||
|
@ -781,7 +781,7 @@ module Api
|
||||||
# Open notes + all closed notes
|
# Open notes + all closed notes
|
||||||
get :index, :params => { :bbox => "1,1,1.7,1.7", :closed => "-1", :format => "json" }
|
get :index, :params => { :bbox => "1,1,1.7,1.7", :closed => "-1", :format => "json" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
js = ActiveSupport::JSON.decode(@response.body)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
assert_equal "FeatureCollection", js["type"]
|
assert_equal "FeatureCollection", js["type"]
|
||||||
|
@ -819,14 +819,14 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :q => "note comment", :format => "xml" }
|
get :search, :params => { :q => "note comment", :format => "xml" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/xml", @response.content_type
|
assert_equal "application/xml", @response.media_type
|
||||||
assert_select "osm", :count => 1 do
|
assert_select "osm", :count => 1 do
|
||||||
assert_select "note", :count => 1
|
assert_select "note", :count => 1
|
||||||
end
|
end
|
||||||
|
|
||||||
get :search, :params => { :q => "note comment", :format => "json" }
|
get :search, :params => { :q => "note comment", :format => "json" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
js = ActiveSupport::JSON.decode(@response.body)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
assert_equal "FeatureCollection", js["type"]
|
assert_equal "FeatureCollection", js["type"]
|
||||||
|
@ -834,7 +834,7 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :q => "note comment", :format => "rss" }
|
get :search, :params => { :q => "note comment", :format => "rss" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "item", :count => 1
|
assert_select "item", :count => 1
|
||||||
|
@ -843,7 +843,7 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :q => "note comment", :format => "gpx" }
|
get :search, :params => { :q => "note comment", :format => "gpx" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/gpx+xml", @response.content_type
|
assert_equal "application/gpx+xml", @response.media_type
|
||||||
assert_select "gpx", :count => 1 do
|
assert_select "gpx", :count => 1 do
|
||||||
assert_select "wpt", :count => 1
|
assert_select "wpt", :count => 1
|
||||||
end
|
end
|
||||||
|
@ -858,14 +858,14 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :display_name => user.display_name, :format => "xml" }
|
get :search, :params => { :display_name => user.display_name, :format => "xml" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/xml", @response.content_type
|
assert_equal "application/xml", @response.media_type
|
||||||
assert_select "osm", :count => 1 do
|
assert_select "osm", :count => 1 do
|
||||||
assert_select "note", :count => 1
|
assert_select "note", :count => 1
|
||||||
end
|
end
|
||||||
|
|
||||||
get :search, :params => { :display_name => user.display_name, :format => "json" }
|
get :search, :params => { :display_name => user.display_name, :format => "json" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
js = ActiveSupport::JSON.decode(@response.body)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
assert_equal "FeatureCollection", js["type"]
|
assert_equal "FeatureCollection", js["type"]
|
||||||
|
@ -873,7 +873,7 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :display_name => user.display_name, :format => "rss" }
|
get :search, :params => { :display_name => user.display_name, :format => "rss" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "item", :count => 1
|
assert_select "item", :count => 1
|
||||||
|
@ -882,7 +882,7 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :display_name => user.display_name, :format => "gpx" }
|
get :search, :params => { :display_name => user.display_name, :format => "gpx" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/gpx+xml", @response.content_type
|
assert_equal "application/gpx+xml", @response.media_type
|
||||||
assert_select "gpx", :count => 1 do
|
assert_select "gpx", :count => 1 do
|
||||||
assert_select "wpt", :count => 1
|
assert_select "wpt", :count => 1
|
||||||
end
|
end
|
||||||
|
@ -897,14 +897,14 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :user => user.id, :format => "xml" }
|
get :search, :params => { :user => user.id, :format => "xml" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/xml", @response.content_type
|
assert_equal "application/xml", @response.media_type
|
||||||
assert_select "osm", :count => 1 do
|
assert_select "osm", :count => 1 do
|
||||||
assert_select "note", :count => 1
|
assert_select "note", :count => 1
|
||||||
end
|
end
|
||||||
|
|
||||||
get :search, :params => { :user => user.id, :format => "json" }
|
get :search, :params => { :user => user.id, :format => "json" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
js = ActiveSupport::JSON.decode(@response.body)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
assert_equal "FeatureCollection", js["type"]
|
assert_equal "FeatureCollection", js["type"]
|
||||||
|
@ -912,7 +912,7 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :user => user.id, :format => "rss" }
|
get :search, :params => { :user => user.id, :format => "rss" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "item", :count => 1
|
assert_select "item", :count => 1
|
||||||
|
@ -921,7 +921,7 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :user => user.id, :format => "gpx" }
|
get :search, :params => { :user => user.id, :format => "gpx" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/gpx+xml", @response.content_type
|
assert_equal "application/gpx+xml", @response.media_type
|
||||||
assert_select "gpx", :count => 1 do
|
assert_select "gpx", :count => 1 do
|
||||||
assert_select "wpt", :count => 1
|
assert_select "wpt", :count => 1
|
||||||
end
|
end
|
||||||
|
@ -932,14 +932,14 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :q => "no match", :format => "xml" }
|
get :search, :params => { :q => "no match", :format => "xml" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/xml", @response.content_type
|
assert_equal "application/xml", @response.media_type
|
||||||
assert_select "osm", :count => 1 do
|
assert_select "osm", :count => 1 do
|
||||||
assert_select "note", :count => 0
|
assert_select "note", :count => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
get :search, :params => { :q => "no match", :format => "json" }
|
get :search, :params => { :q => "no match", :format => "json" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
js = ActiveSupport::JSON.decode(@response.body)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
assert_equal "FeatureCollection", js["type"]
|
assert_equal "FeatureCollection", js["type"]
|
||||||
|
@ -947,7 +947,7 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :q => "no match", :format => "rss" }
|
get :search, :params => { :q => "no match", :format => "rss" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "item", :count => 0
|
assert_select "item", :count => 0
|
||||||
|
@ -956,7 +956,7 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :q => "no match", :format => "gpx" }
|
get :search, :params => { :q => "no match", :format => "gpx" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/gpx+xml", @response.content_type
|
assert_equal "application/gpx+xml", @response.media_type
|
||||||
assert_select "gpx", :count => 1 do
|
assert_select "gpx", :count => 1 do
|
||||||
assert_select "wpt", :count => 0
|
assert_select "wpt", :count => 0
|
||||||
end
|
end
|
||||||
|
@ -967,14 +967,14 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :from => "01.01.2010", :to => "01.10.2010", :format => "xml" }
|
get :search, :params => { :from => "01.01.2010", :to => "01.10.2010", :format => "xml" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/xml", @response.content_type
|
assert_equal "application/xml", @response.media_type
|
||||||
assert_select "osm", :count => 1 do
|
assert_select "osm", :count => 1 do
|
||||||
assert_select "note", :count => 0
|
assert_select "note", :count => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
get :search, :params => { :from => "01.01.2010", :to => "01.10.2010", :format => "json" }
|
get :search, :params => { :from => "01.01.2010", :to => "01.10.2010", :format => "json" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/json", @response.content_type
|
assert_equal "application/json", @response.media_type
|
||||||
js = ActiveSupport::JSON.decode(@response.body)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
assert_equal "FeatureCollection", js["type"]
|
assert_equal "FeatureCollection", js["type"]
|
||||||
|
@ -982,7 +982,7 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :from => "01.01.2010", :to => "01.10.2010", :format => "rss" }
|
get :search, :params => { :from => "01.01.2010", :to => "01.10.2010", :format => "rss" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "item", :count => 0
|
assert_select "item", :count => 0
|
||||||
|
@ -991,7 +991,7 @@ module Api
|
||||||
|
|
||||||
get :search, :params => { :from => "01.01.2010", :to => "01.10.2010", :format => "gpx" }
|
get :search, :params => { :from => "01.01.2010", :to => "01.10.2010", :format => "gpx" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/gpx+xml", @response.content_type
|
assert_equal "application/gpx+xml", @response.media_type
|
||||||
assert_select "gpx", :count => 1 do
|
assert_select "gpx", :count => 1 do
|
||||||
assert_select "wpt", :count => 0
|
assert_select "wpt", :count => 0
|
||||||
end
|
end
|
||||||
|
@ -1027,7 +1027,7 @@ module Api
|
||||||
|
|
||||||
get :feed, :params => { :format => "rss" }
|
get :feed, :params => { :format => "rss" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "item", :count => 4
|
assert_select "item", :count => 4
|
||||||
|
@ -1036,7 +1036,7 @@ module Api
|
||||||
|
|
||||||
get :feed, :params => { :bbox => "1,1,1.2,1.2", :format => "rss" }
|
get :feed, :params => { :bbox => "1,1,1.2,1.2", :format => "rss" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "item", :count => 2
|
assert_select "item", :count => 2
|
||||||
|
|
|
@ -336,7 +336,7 @@ module Api
|
||||||
def check_trace_data(trace, digest, content_type = "application/gpx+xml", extension = "gpx")
|
def check_trace_data(trace, digest, content_type = "application/gpx+xml", extension = "gpx")
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal digest, Digest::MD5.hexdigest(response.body)
|
assert_equal digest, Digest::MD5.hexdigest(response.body)
|
||||||
assert_equal content_type, response.content_type
|
assert_equal content_type, response.media_type
|
||||||
assert_equal "attachment; filename=\"#{trace.id}.#{extension}\"; filename*=UTF-8''#{trace.id}.#{extension}", @response.header["Content-Disposition"]
|
assert_equal "attachment; filename=\"#{trace.id}.#{extension}\"; filename*=UTF-8''#{trace.id}.#{extension}", @response.header["Content-Disposition"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ module Api
|
||||||
# try the read again
|
# try the read again
|
||||||
get :index
|
get :index
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/xml", @response.content_type
|
assert_equal "application/xml", @response.media_type
|
||||||
assert_select "osm" do
|
assert_select "osm" do
|
||||||
assert_select "preferences", :count => 1 do
|
assert_select "preferences", :count => 1 do
|
||||||
assert_select "preference", :count => 2
|
assert_select "preference", :count => 2
|
||||||
|
@ -80,7 +80,7 @@ module Api
|
||||||
# try the read again
|
# try the read again
|
||||||
get :show, :params => { :preference_key => "key" }
|
get :show, :params => { :preference_key => "key" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "text/plain", @response.content_type
|
assert_equal "text/plain", @response.media_type
|
||||||
assert_equal "value", @response.body
|
assert_equal "value", @response.body
|
||||||
|
|
||||||
# try the read again for a non-existent key
|
# try the read again for a non-existent key
|
||||||
|
@ -114,7 +114,7 @@ module Api
|
||||||
put :update_all, :body => "<osm><preferences><preference k='key' v='new_value'/><preference k='new_key' v='value'/></preferences></osm>"
|
put :update_all, :body => "<osm><preferences><preference k='key' v='new_value'/><preference k='new_key' v='value'/></preferences></osm>"
|
||||||
end
|
end
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "text/plain", @response.content_type
|
assert_equal "text/plain", @response.media_type
|
||||||
assert_equal "", @response.body
|
assert_equal "", @response.body
|
||||||
assert_equal "new_value", UserPreference.find([user.id, "key"]).v
|
assert_equal "new_value", UserPreference.find([user.id, "key"]).v
|
||||||
assert_equal "value", UserPreference.find([user.id, "new_key"]).v
|
assert_equal "value", UserPreference.find([user.id, "new_key"]).v
|
||||||
|
@ -127,7 +127,7 @@ module Api
|
||||||
put :update_all, :body => "<osm><preferences><preference k='key' v='value'/><preference k='key' v='newer_value'/></preferences></osm>"
|
put :update_all, :body => "<osm><preferences><preference k='key' v='value'/><preference k='key' v='newer_value'/></preferences></osm>"
|
||||||
end
|
end
|
||||||
assert_response :bad_request
|
assert_response :bad_request
|
||||||
assert_equal "text/plain", @response.content_type
|
assert_equal "text/plain", @response.media_type
|
||||||
assert_equal "Duplicate preferences with key key", @response.body
|
assert_equal "Duplicate preferences with key key", @response.body
|
||||||
assert_equal "new_value", UserPreference.find([user.id, "key"]).v
|
assert_equal "new_value", UserPreference.find([user.id, "key"]).v
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ module Api
|
||||||
put :update, :params => { :preference_key => "new_key" }, :body => "new_value"
|
put :update, :params => { :preference_key => "new_key" }, :body => "new_value"
|
||||||
end
|
end
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "text/plain", @response.content_type
|
assert_equal "text/plain", @response.media_type
|
||||||
assert_equal "", @response.body
|
assert_equal "", @response.body
|
||||||
assert_equal "new_value", UserPreference.find([user.id, "new_key"]).v
|
assert_equal "new_value", UserPreference.find([user.id, "new_key"]).v
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ module Api
|
||||||
put :update, :params => { :preference_key => "new_key" }, :body => "newer_value"
|
put :update, :params => { :preference_key => "new_key" }, :body => "newer_value"
|
||||||
end
|
end
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "text/plain", @response.content_type
|
assert_equal "text/plain", @response.media_type
|
||||||
assert_equal "", @response.body
|
assert_equal "", @response.body
|
||||||
assert_equal "newer_value", UserPreference.find([user.id, "new_key"]).v
|
assert_equal "newer_value", UserPreference.find([user.id, "new_key"]).v
|
||||||
end
|
end
|
||||||
|
@ -196,7 +196,7 @@ module Api
|
||||||
get :destroy, :params => { :preference_key => "key" }
|
get :destroy, :params => { :preference_key => "key" }
|
||||||
end
|
end
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "text/plain", @response.content_type
|
assert_equal "text/plain", @response.media_type
|
||||||
assert_equal "", @response.body
|
assert_equal "", @response.body
|
||||||
assert_raises ActiveRecord::RecordNotFound do
|
assert_raises ActiveRecord::RecordNotFound do
|
||||||
UserPreference.find([user.id, "key"])
|
UserPreference.find([user.id, "key"])
|
||||||
|
|
|
@ -34,7 +34,7 @@ module Api
|
||||||
# check that a visible user is returned properly
|
# check that a visible user is returned properly
|
||||||
get :show, :params => { :id => user.id }
|
get :show, :params => { :id => user.id }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "text/xml", response.content_type
|
assert_equal "text/xml", response.media_type
|
||||||
|
|
||||||
# check the data that is returned
|
# check the data that is returned
|
||||||
assert_select "description", :count => 1, :text => "test"
|
assert_select "description", :count => 1, :text => "test"
|
||||||
|
@ -90,7 +90,7 @@ module Api
|
||||||
basic_authorization user.email, "test"
|
basic_authorization user.email, "test"
|
||||||
get :details
|
get :details
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "text/xml", response.content_type
|
assert_equal "text/xml", response.media_type
|
||||||
|
|
||||||
# check the data that is returned
|
# check the data that is returned
|
||||||
assert_select "description", :count => 1, :text => "test"
|
assert_select "description", :count => 1, :text => "test"
|
||||||
|
@ -136,7 +136,7 @@ module Api
|
||||||
|
|
||||||
get :index, :params => { :users => user1.id }
|
get :index, :params => { :users => user1.id }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "text/xml", response.content_type
|
assert_equal "text/xml", response.media_type
|
||||||
assert_select "user", :count => 1 do
|
assert_select "user", :count => 1 do
|
||||||
assert_select "user[id='#{user1.id}']", :count => 1
|
assert_select "user[id='#{user1.id}']", :count => 1
|
||||||
assert_select "user[id='#{user2.id}']", :count => 0
|
assert_select "user[id='#{user2.id}']", :count => 0
|
||||||
|
@ -145,7 +145,7 @@ module Api
|
||||||
|
|
||||||
get :index, :params => { :users => user2.id }
|
get :index, :params => { :users => user2.id }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "text/xml", response.content_type
|
assert_equal "text/xml", response.media_type
|
||||||
assert_select "user", :count => 1 do
|
assert_select "user", :count => 1 do
|
||||||
assert_select "user[id='#{user1.id}']", :count => 0
|
assert_select "user[id='#{user1.id}']", :count => 0
|
||||||
assert_select "user[id='#{user2.id}']", :count => 1
|
assert_select "user[id='#{user2.id}']", :count => 1
|
||||||
|
@ -154,7 +154,7 @@ module Api
|
||||||
|
|
||||||
get :index, :params => { :users => "#{user1.id},#{user3.id}" }
|
get :index, :params => { :users => "#{user1.id},#{user3.id}" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "text/xml", response.content_type
|
assert_equal "text/xml", response.media_type
|
||||||
assert_select "user", :count => 2 do
|
assert_select "user", :count => 2 do
|
||||||
assert_select "user[id='#{user1.id}']", :count => 1
|
assert_select "user[id='#{user1.id}']", :count => 1
|
||||||
assert_select "user[id='#{user2.id}']", :count => 0
|
assert_select "user[id='#{user2.id}']", :count => 0
|
||||||
|
@ -187,7 +187,7 @@ module Api
|
||||||
basic_authorization user.email, "test"
|
basic_authorization user.email, "test"
|
||||||
get :gpx_files
|
get :gpx_files
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/xml", response.content_type
|
assert_equal "application/xml", response.media_type
|
||||||
|
|
||||||
# check the data that is returned
|
# check the data that is returned
|
||||||
assert_select "gpx_file[id='#{trace1.id}']", 1 do
|
assert_select "gpx_file[id='#{trace1.id}']", 1 do
|
||||||
|
|
|
@ -22,7 +22,7 @@ class ChangesetCommentsControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
get :index, :params => { :format => "rss" }
|
get :index, :params => { :format => "rss" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "item", :count => 3
|
assert_select "item", :count => 3
|
||||||
|
@ -31,7 +31,7 @@ class ChangesetCommentsControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
get :index, :params => { :format => "rss", :limit => 2 }
|
get :index, :params => { :format => "rss", :limit => 2 }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "item", :count => 2
|
assert_select "item", :count => 2
|
||||||
|
@ -40,7 +40,7 @@ class ChangesetCommentsControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
get :index, :params => { :id => changeset.id, :format => "rss" }
|
get :index, :params => { :id => changeset.id, :format => "rss" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "item", :count => 3
|
assert_select "item", :count => 3
|
||||||
|
|
|
@ -214,7 +214,7 @@ class ChangesetsControllerTest < ActionController::TestCase
|
||||||
get :feed, :params => { :format => :atom }
|
get :feed, :params => { :format => :atom }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template "index"
|
assert_template "index"
|
||||||
assert_equal "application/atom+xml", response.content_type
|
assert_equal "application/atom+xml", response.media_type
|
||||||
|
|
||||||
check_feed_result([changeset, closed_changeset])
|
check_feed_result([changeset, closed_changeset])
|
||||||
end
|
end
|
||||||
|
@ -232,7 +232,7 @@ class ChangesetsControllerTest < ActionController::TestCase
|
||||||
get :feed, :params => { :format => :atom, :bbox => "4.5,4.5,5.5,5.5" }
|
get :feed, :params => { :format => :atom, :bbox => "4.5,4.5,5.5,5.5" }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template "index"
|
assert_template "index"
|
||||||
assert_equal "application/atom+xml", response.content_type
|
assert_equal "application/atom+xml", response.media_type
|
||||||
|
|
||||||
check_feed_result([changeset, closed_changeset])
|
check_feed_result([changeset, closed_changeset])
|
||||||
end
|
end
|
||||||
|
@ -250,7 +250,7 @@ class ChangesetsControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template "index"
|
assert_template "index"
|
||||||
assert_equal "application/atom+xml", response.content_type
|
assert_equal "application/atom+xml", response.media_type
|
||||||
|
|
||||||
check_feed_result(changesets)
|
check_feed_result(changesets)
|
||||||
end
|
end
|
||||||
|
|
|
@ -681,7 +681,7 @@ class TracesControllerTest < ActionController::TestCase
|
||||||
def check_trace_feed(traces)
|
def check_trace_feed(traces)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template "georss"
|
assert_template "georss"
|
||||||
assert_equal "application/rss+xml", @response.content_type
|
assert_equal "application/rss+xml", @response.media_type
|
||||||
assert_select "rss", :count => 1 do
|
assert_select "rss", :count => 1 do
|
||||||
assert_select "channel", :count => 1 do
|
assert_select "channel", :count => 1 do
|
||||||
assert_select "title"
|
assert_select "title"
|
||||||
|
@ -736,19 +736,19 @@ class TracesControllerTest < ActionController::TestCase
|
||||||
def check_trace_data(trace, digest, content_type = "application/gpx+xml", extension = "gpx")
|
def check_trace_data(trace, digest, content_type = "application/gpx+xml", extension = "gpx")
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal digest, Digest::MD5.hexdigest(response.body)
|
assert_equal digest, Digest::MD5.hexdigest(response.body)
|
||||||
assert_equal content_type, response.content_type
|
assert_equal content_type, response.media_type
|
||||||
assert_equal "attachment; filename=\"#{trace.id}.#{extension}\"; filename*=UTF-8''#{trace.id}.#{extension}", @response.header["Content-Disposition"]
|
assert_equal "attachment; filename=\"#{trace.id}.#{extension}\"; filename*=UTF-8''#{trace.id}.#{extension}", @response.header["Content-Disposition"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_trace_picture(trace)
|
def check_trace_picture(trace)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "image/gif", response.content_type
|
assert_equal "image/gif", response.media_type
|
||||||
assert_equal trace.large_picture, response.body
|
assert_equal trace.large_picture, response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_trace_icon(trace)
|
def check_trace_icon(trace)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "image/gif", response.content_type
|
assert_equal "image/gif", response.media_type
|
||||||
assert_equal trace.icon_picture, response.body
|
assert_equal trace.icon_picture, response.body
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ class CORSTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal "*", response.headers["Access-Control-Allow-Origin"]
|
assert_equal "*", response.headers["Access-Control-Allow-Origin"]
|
||||||
assert_nil response.content_type
|
assert_nil response.media_type
|
||||||
assert_equal "", response.body
|
assert_equal "", response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class CORSTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_nil response.headers["Access-Control-Allow-Origin"]
|
assert_nil response.headers["Access-Control-Allow-Origin"]
|
||||||
assert_nil response.content_type
|
assert_nil response.media_type
|
||||||
assert_equal "", response.body
|
assert_equal "", response.body
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue