- { :controller => "changeset", :action => "list", :friends => true, :format => :html }
+ { :controller => "changeset", :action => "index", :friends => true, :format => :html }
- { :controller => "changeset", :action => "list", :nearby => true, :format => :html }
+ { :controller => "changeset", :action => "index", :nearby => true, :format => :html }
get :read, :params => { :id => id }
assert_response :not_found, "should get a not found"
rescue ActionController::UrlGenerationError => ex
get :read, :params => { :id => id }
assert_response :not_found, "should get a not found"
rescue ActionController::UrlGenerationError => ex
put :close, :params => { :id => id }
assert_response :unauthorized, "Shouldn't be able close the non-existant changeset #{id}, when not authorized"
rescue ActionController::UrlGenerationError => ex
put :close, :params => { :id => id }
assert_response :unauthorized, "Shouldn't be able close the non-existant changeset #{id}, when not authorized"
rescue ActionController::UrlGenerationError => ex
put :close, :params => { :id => id }
assert_response :not_found, "The changeset #{id} doesn't exist, so can't be closed"
rescue ActionController::UrlGenerationError => ex
put :close, :params => { :id => id }
assert_response :not_found, "The changeset #{id} doesn't exist, so can't be closed"
rescue ActionController::UrlGenerationError => ex
new_rel_id = doc.find("//diffResult/relation").first["new_id"].to_i
# check the old IDs are all present and negative one
new_rel_id = doc.find("//diffResult/relation").first["new_id"].to_i
# check the old IDs are all present and negative one
- assert_equal -1, doc.find("//diffResult/node").first["old_id"].to_i
- assert_equal -1, doc.find("//diffResult/way").first["old_id"].to_i
- assert_equal -1, doc.find("//diffResult/relation").first["old_id"].to_i
+ assert_equal(-1, doc.find("//diffResult/node").first["old_id"].to_i)
+ assert_equal(-1, doc.find("//diffResult/way").first["old_id"].to_i)
+ assert_equal(-1, doc.find("//diffResult/relation").first["old_id"].to_i)
# check the versions are present and equal one
assert_equal 1, doc.find("//diffResult/node").first["new_version"].to_i
# check the versions are present and equal one
assert_equal 1, doc.find("//diffResult/node").first["new_version"].to_i
basic_authorization create(:user).email, "test"
# create a temporary changeset
basic_authorization create(:user).email, "test"
# create a temporary changeset
assert_response :success, "Should be able to create a changeset: #{@response.body}"
changeset_id = @response.body.to_i
assert_response :success, "Should be able to create a changeset: #{@response.body}"
changeset_id = @response.body.to_i
assert cs.min_lon >= -180 * GeoRecord::SCALE, "Minimum longitude (#{cs.min_lon / GeoRecord::SCALE}) should be >= -180 to be valid."
assert cs.max_lon <= 180 * GeoRecord::SCALE, "Maximum longitude (#{cs.max_lon / GeoRecord::SCALE}) should be <= 180 to be valid."
assert cs.min_lat >= -90 * GeoRecord::SCALE, "Minimum latitude (#{cs.min_lat / GeoRecord::SCALE}) should be >= -90 to be valid."
assert cs.min_lon >= -180 * GeoRecord::SCALE, "Minimum longitude (#{cs.min_lon / GeoRecord::SCALE}) should be >= -180 to be valid."
assert cs.max_lon <= 180 * GeoRecord::SCALE, "Maximum longitude (#{cs.max_lon / GeoRecord::SCALE}) should be <= 180 to be valid."
assert cs.min_lat >= -90 * GeoRecord::SCALE, "Minimum latitude (#{cs.min_lat / GeoRecord::SCALE}) should be >= -90 to be valid."
assert_equal 2, Node.find(new_node_id).tags.size, "new node should have two tags"
assert_equal [new_node_id, node.id], Way.find(way.id).nds, "way nodes should match"
Relation.find(relation.id).members.each do |type, id, _role|
assert_equal 2, Node.find(new_node_id).tags.size, "new node should have two tags"
assert_equal [new_node_id, node.id], Way.find(way.id).nds, "way nodes should match"
Relation.find(relation.id).members.each do |type, id, _role|
# get the bounding box back from the changeset
get :read, :params => { :id => changeset_id }
assert_response :success, "Couldn't read back changeset for the third time."
# get the bounding box back from the changeset
get :read, :params => { :id => changeset_id }
assert_response :success, "Couldn't read back changeset for the third time."
assert_equal Changeset::MAX_ELEMENTS + 1, changeset.num_changes
# check that the changeset is now closed as well
assert_equal Changeset::MAX_ELEMENTS + 1, changeset.num_changes
# check that the changeset is now closed as well
- assert(!changeset.is_open?,
- "changeset should have been auto-closed by exceeding " \
- "element limit.")
+ assert_not(changeset.is_open?,
+ "changeset should have been auto-closed by exceeding " \
+ "element limit.")
assert_response :success
assert_template "history"
assert_template :layout => "map"
assert_select "h2", :text => "Changesets", :count => 1
assert_response :success
assert_template "history"
assert_template :layout => "map"
assert_select "h2", :text => "Changesets", :count => 1
- get :list, :params => { :format => "html", :list => "1" }, :xhr => true
+ get :index, :params => { :format => "html", :list => "1" }, :xhr => true
assert_response :success
assert_template "history"
assert_template :layout => "xhr"
assert_select "h2", :text => "Changesets", :count => 1
assert_response :success
assert_template "history"
assert_template :layout => "xhr"
assert_select "h2", :text => "Changesets", :count => 1
- get :list, :params => { :format => "html", :list => "1" }, :xhr => true
+ get :index, :params => { :format => "html", :list => "1" }, :xhr => true
- def test_list_bbox
- get :list, :params => { :format => "html", :bbox => "4.5,4.5,5.5,5.5" }
+ def test_index_bbox
+ get :index, :params => { :format => "html", :bbox => "4.5,4.5,5.5,5.5" }
assert_response :success
assert_template "history"
assert_template :layout => "map"
assert_select "h2", :text => "Changesets", :count => 1
assert_response :success
assert_template "history"
assert_template :layout => "map"
assert_select "h2", :text => "Changesets", :count => 1
- get :list, :params => { :format => "html", :bbox => "4.5,4.5,5.5,5.5", :list => "1" }, :xhr => true
+ get :index, :params => { :format => "html", :bbox => "4.5,4.5,5.5,5.5", :list => "1" }, :xhr => true
user = create(:user)
create(:changeset, :user => user)
create(:changeset, :closed, :user => user)
user = create(:user)
create(:changeset, :user => user)
create(:changeset, :closed, :user => user)
- get :list, :params => { :format => "html", :display_name => user.display_name, :list => "1" }, :xhr => true
+ get :index, :params => { :format => "html", :display_name => user.display_name, :list => "1" }, :xhr => true
private_user = create(:user, :data_public => false)
create(:changeset, :user => private_user)
create(:changeset, :closed, :user => private_user)
private_user = create(:user, :data_public => false)
create(:changeset, :user => private_user)
create(:changeset, :closed, :user => private_user)
- get :list, :params => { :format => "html", :display_name => private_user.display_name, :list => "1" }, :xhr => true
+ get :index, :params => { :format => "html", :display_name => private_user.display_name, :list => "1" }, :xhr => true
- # Check the not found of the list user changesets
- def test_list_user_not_found
- get :list, :params => { :format => "html", :display_name => "Some random user" }
+ # Check the not found of the index user changesets
+ def test_index_user_not_found
+ get :index, :params => { :format => "html", :display_name => "Some random user" }
- get :list, :params => { :format => "html", :display_name => "Some random user", :list => "1" }, :xhr => true
+ get :index, :params => { :format => "html", :display_name => "Some random user", :list => "1" }, :xhr => true
assert_response :not_found
assert_template "user/no_such_user"
end
##
# Checks the display of the friends changesets listing
assert_response :not_found
assert_template "user/no_such_user"
end
##
# Checks the display of the friends changesets listing
private_user = create(:user, :data_public => true)
friend = create(:friend, :befriender => private_user)
create(:changeset, :user => friend.befriendee)
private_user = create(:user, :data_public => true)
friend = create(:friend, :befriender => private_user)
create(:changeset, :user => friend.befriendee)
assert_response :redirect
assert_redirected_to :controller => :user, :action => :login, :referer => friend_changesets_path
session[:user] = private_user.id
assert_response :redirect
assert_redirected_to :controller => :user, :action => :login, :referer => friend_changesets_path
session[:user] = private_user.id
- get :list, :params => { :friends => true, :list => "1" }, :xhr => true
+ get :index, :params => { :friends => true, :list => "1" }, :xhr => true
private_user = create(:user, :data_public => false, :home_lat => 51.1, :home_lon => 1.0)
user = create(:user, :home_lat => 51.0, :home_lon => 1.0)
create(:changeset, :user => user)
private_user = create(:user, :data_public => false, :home_lat => 51.1, :home_lon => 1.0)
user = create(:user, :home_lat => 51.0, :home_lon => 1.0)
create(:changeset, :user => user)
assert_response :redirect
assert_redirected_to :controller => :user, :action => :login, :referer => nearby_changesets_path
session[:user] = private_user.id
assert_response :redirect
assert_redirected_to :controller => :user, :action => :login, :referer => nearby_changesets_path
session[:user] = private_user.id
- get :list, :params => { :nearby => true, :list => "1" }, :xhr => true
+ get :index, :params => { :nearby => true, :list => "1" }, :xhr => true
- # Check that we can't request later pages of the changesets list
- def test_list_max_id
- get :list, :params => { :format => "html", :max_id => 4 }, :xhr => true
+ # Check that we can't request later pages of the changesets index
+ def test_index_max_id
+ get :index, :params => { :format => "html", :max_id => 4 }, :xhr => true
assert_response :success
assert_template "history"
assert_template :layout => "xhr"
assert_select "h2", :text => "Changesets", :count => 1
assert_response :success
assert_template "history"
assert_template :layout => "xhr"
assert_select "h2", :text => "Changesets", :count => 1
- get :list, :params => { :format => "html", :list => "1", :max_id => 4 }, :xhr => true
+ get :index, :params => { :format => "html", :list => "1", :max_id => 4 }, :xhr => true
# This should display the last 20 non-empty changesets
def test_feed
changeset = create(:changeset, :num_changes => 1)
# This should display the last 20 non-empty changesets
def test_feed
changeset = create(:changeset, :num_changes => 1)
closed_changeset = create(:changeset, :closed, :num_changes => 1)
_empty_changeset = create(:changeset, :num_changes => 0)
get :feed, :params => { :format => :atom }
assert_response :success
closed_changeset = create(:changeset, :closed, :num_changes => 1)
_empty_changeset = create(:changeset, :num_changes => 0)
get :feed, :params => { :format => :atom }
assert_response :success
assert_equal "application/atom+xml", response.content_type
check_feed_result([changeset, closed_changeset])
assert_equal "application/atom+xml", response.content_type
check_feed_result([changeset, closed_changeset])
# This should display the last 20 changesets closed in a specific area
def test_feed_bbox
changeset = create(:changeset, :num_changes => 1, :min_lat => 5 * GeoRecord::SCALE, :min_lon => 5 * GeoRecord::SCALE, :max_lat => 5 * GeoRecord::SCALE, :max_lon => 5 * GeoRecord::SCALE)
# This should display the last 20 changesets closed in a specific area
def test_feed_bbox
changeset = create(:changeset, :num_changes => 1, :min_lat => 5 * GeoRecord::SCALE, :min_lon => 5 * GeoRecord::SCALE, :max_lat => 5 * GeoRecord::SCALE, :max_lon => 5 * GeoRecord::SCALE)
closed_changeset = create(:changeset, :closed, :num_changes => 1, :min_lat => 5 * GeoRecord::SCALE, :min_lon => 5 * GeoRecord::SCALE, :max_lat => 5 * GeoRecord::SCALE, :max_lon => 5 * GeoRecord::SCALE)
_elsewhere_changeset = create(:changeset, :num_changes => 1, :min_lat => -5 * GeoRecord::SCALE, :min_lon => -5 * GeoRecord::SCALE, :max_lat => -5 * GeoRecord::SCALE, :max_lon => -5 * GeoRecord::SCALE)
_empty_changeset = create(:changeset, :num_changes => 0, :min_lat => -5 * GeoRecord::SCALE, :min_lon => -5 * GeoRecord::SCALE, :max_lat => -5 * GeoRecord::SCALE, :max_lon => -5 * GeoRecord::SCALE)
get :feed, :params => { :format => :atom, :bbox => "4.5,4.5,5.5,5.5" }
assert_response :success
closed_changeset = create(:changeset, :closed, :num_changes => 1, :min_lat => 5 * GeoRecord::SCALE, :min_lon => 5 * GeoRecord::SCALE, :max_lat => 5 * GeoRecord::SCALE, :max_lon => 5 * GeoRecord::SCALE)
_elsewhere_changeset = create(:changeset, :num_changes => 1, :min_lat => -5 * GeoRecord::SCALE, :min_lon => -5 * GeoRecord::SCALE, :max_lat => -5 * GeoRecord::SCALE, :max_lon => -5 * GeoRecord::SCALE)
_empty_changeset = create(:changeset, :num_changes => 0, :min_lat => -5 * GeoRecord::SCALE, :min_lon => -5 * GeoRecord::SCALE, :max_lat => -5 * GeoRecord::SCALE, :max_lon => -5 * GeoRecord::SCALE)
get :feed, :params => { :format => :atom, :bbox => "4.5,4.5,5.5,5.5" }
assert_response :success
assert_equal "application/atom+xml", response.content_type
check_feed_result([changeset, closed_changeset])
assert_equal "application/atom+xml", response.content_type
check_feed_result([changeset, closed_changeset])
def test_feed_user
user = create(:user)
changesets = create_list(:changeset, 3, :user => user, :num_changes => 4)
def test_feed_user
user = create(:user)
changesets = create_list(:changeset, 3, :user => user, :num_changes => 4)
_other_changeset = create(:changeset)
get :feed, :params => { :format => :atom, :display_name => user.display_name }
assert_response :success
_other_changeset = create(:changeset)
get :feed, :params => { :format => :atom, :display_name => user.display_name }
assert_response :success
assert_equal "application/atom+xml", response.content_type
check_feed_result(changesets)
assert_equal "application/atom+xml", response.content_type
check_feed_result(changesets)
+
+ # not closed changeset
+ changeset = create(:changeset)
+ assert_difference "changeset.subscribers.count", 1 do
+ post :subscribe, :params => { :id => changeset.id }
+ end
+ assert_response :success
- # not closed changeset
- changeset = create(:changeset)
- assert_no_difference "changeset.subscribers.count" do
- post :subscribe, :params => { :id => changeset.id }
- end
- assert_response :conflict
-
# trying to subscribe when already subscribed
changeset = create(:changeset, :closed)
changeset.subscribers.push(user)
# trying to subscribe when already subscribed
changeset = create(:changeset, :closed)
changeset.subscribers.push(user)
+
+ # not closed changeset
+ changeset = create(:changeset)
+ changeset.subscribers.push(user)
+
+ assert_difference "changeset.subscribers.count", -1 do
+ post :unsubscribe, :params => { :id => changeset.id }
+ end
+ assert_response :success
- # not closed changeset
- changeset = create(:changeset)
- assert_no_difference "changeset.subscribers.count" do
- post :unsubscribe, :params => { :id => changeset.id }
- end
- assert_response :conflict
-
# trying to unsubscribe when not subscribed
changeset = create(:changeset, :closed)
assert_no_difference "changeset.subscribers.count" do
# trying to unsubscribe when not subscribed
changeset = create(:changeset, :closed)
assert_no_difference "changeset.subscribers.count" do