- fixtures :users, :user_roles
+ def setup
+ # Stub nominatim response for note locations
+ stub_request(:get, %r{^http://nominatim\.openstreetmap\.org/reverse\?})
+ .to_return(:status => 404)
+ end
- create(:note_comment, :note => note, :author => users(:normal_user))
- create(:note_comment, :note => note, :author => users(:second_public_user))
+ create(:note_comment, :note => note, :author => first_user)
+ create(:note_comment, :note => note, :author => second_user)
end
assert_difference "NoteComment.count", 1 do
assert_difference "ActionMailer::Base.deliveries.size", 2 do
end
assert_difference "NoteComment.count", 1 do
assert_difference "ActionMailer::Base.deliveries.size", 2 do
assert_equal "This is an additional comment", js["properties"]["comments"].last["text"]
assert_nil js["properties"]["comments"].last["user"]
assert_equal "This is an additional comment", js["properties"]["comments"].last["text"]
assert_nil js["properties"]["comments"].last["user"]
assert_not_nil email
assert_equal 1, email.to.length
assert_equal "[OpenStreetMap] An anonymous user has commented on one of your notes", email.subject
assert_not_nil email
assert_equal 1, email.to.length
assert_equal "[OpenStreetMap] An anonymous user has commented on one of your notes", email.subject
assert_not_nil email
assert_equal 1, email.to.length
assert_equal "[OpenStreetMap] An anonymous user has commented on a note you are interested in", email.subject
assert_not_nil email
assert_equal 1, email.to.length
assert_equal "[OpenStreetMap] An anonymous user has commented on a note you are interested in", email.subject
assert_difference "NoteComment.count", 1 do
assert_difference "ActionMailer::Base.deliveries.size", 2 do
assert_difference "NoteComment.count", 1 do
assert_difference "ActionMailer::Base.deliveries.size", 2 do
assert_equal 4, js["properties"]["comments"].count
assert_equal "commented", js["properties"]["comments"].last["action"]
assert_equal "This is an additional comment", js["properties"]["comments"].last["text"]
assert_equal 4, js["properties"]["comments"].count
assert_equal "commented", js["properties"]["comments"].last["action"]
assert_equal "This is an additional comment", js["properties"]["comments"].last["text"]
- assert_equal "[OpenStreetMap] test2 has commented on one of your notes", email.subject
- assert_equal "test@openstreetmap.org", email.to.first
+ assert_equal "[OpenStreetMap] #{third_user.display_name} has commented on one of your notes", email.subject
+ assert_equal first_user.email, email.to.first
assert_equal 4, js["properties"]["comments"].count
assert_equal "commented", js["properties"]["comments"].last["action"]
assert_equal "This is an additional comment", js["properties"]["comments"].last["text"]
assert_equal 4, js["properties"]["comments"].count
assert_equal "commented", js["properties"]["comments"].last["action"]
assert_equal "This is an additional comment", js["properties"]["comments"].last["text"]
post :close, :id => open_note_with_comment.id, :text => "This is a close comment", :format => "json"
assert_response :unauthorized
post :close, :id => open_note_with_comment.id, :text => "This is a close comment", :format => "json"
assert_response :unauthorized
post :close, :id => open_note_with_comment.id, :text => "This is a close comment", :format => "json"
assert_response :success
post :close, :id => open_note_with_comment.id, :text => "This is a close comment", :format => "json"
assert_response :success
assert_equal 2, js["properties"]["comments"].count
assert_equal "closed", js["properties"]["comments"].last["action"]
assert_equal "This is a close comment", js["properties"]["comments"].last["text"]
assert_equal 2, js["properties"]["comments"].count
assert_equal "closed", js["properties"]["comments"].last["action"]
assert_equal "This is a close comment", js["properties"]["comments"].last["text"]
assert_equal 2, js["properties"]["comments"].count
assert_equal "closed", js["properties"]["comments"].last["action"]
assert_equal "This is a close comment", js["properties"]["comments"].last["text"]
assert_equal 2, js["properties"]["comments"].count
assert_equal "closed", js["properties"]["comments"].last["action"]
assert_equal "This is a close comment", js["properties"]["comments"].last["text"]
post :reopen, :id => closed_note_with_comment.id, :text => "This is a reopen comment", :format => "json"
assert_response :unauthorized
post :reopen, :id => closed_note_with_comment.id, :text => "This is a reopen comment", :format => "json"
assert_response :unauthorized
post :reopen, :id => closed_note_with_comment.id, :text => "This is a reopen comment", :format => "json"
assert_response :success
post :reopen, :id => closed_note_with_comment.id, :text => "This is a reopen comment", :format => "json"
assert_response :success
assert_equal 2, js["properties"]["comments"].count
assert_equal "reopened", js["properties"]["comments"].last["action"]
assert_equal "This is a reopen comment", js["properties"]["comments"].last["text"]
assert_equal 2, js["properties"]["comments"].count
assert_equal "reopened", js["properties"]["comments"].last["action"]
assert_equal "This is a reopen comment", js["properties"]["comments"].last["text"]
assert_equal 2, js["properties"]["comments"].count
assert_equal "reopened", js["properties"]["comments"].last["action"]
assert_equal "This is a reopen comment", js["properties"]["comments"].last["text"]
assert_equal 2, js["properties"]["comments"].count
assert_equal "reopened", js["properties"]["comments"].last["action"]
assert_equal "This is a reopen comment", js["properties"]["comments"].last["text"]
post :reopen, :id => hidden_note_with_comment.id
assert_response :unauthorized
post :reopen, :id => hidden_note_with_comment.id
assert_response :unauthorized
post :reopen, :id => 12345
assert_response :not_found
post :reopen, :id => 12345
assert_response :not_found
assert_select "time", :count => 1
assert_select "name", "Note: #{open_note.id}"
assert_select "desc", :count => 1
assert_select "time", :count => 1
assert_select "name", "Note: #{open_note.id}"
assert_select "desc", :count => 1
assert_select "extensions", :count => 1 do
assert_select "id", open_note.id.to_s
assert_select "url", note_url(open_note, :format => "gpx")
assert_select "extensions", :count => 1 do
assert_select "id", open_note.id.to_s
assert_select "url", note_url(open_note, :format => "gpx")
delete :destroy, :id => open_note_with_comment.id, :text => "This is a hide comment", :format => "json"
assert_response :unauthorized
delete :destroy, :id => open_note_with_comment.id, :text => "This is a hide comment", :format => "json"
assert_response :unauthorized
delete :destroy, :id => open_note_with_comment.id, :text => "This is a hide comment", :format => "json"
assert_response :forbidden
delete :destroy, :id => open_note_with_comment.id, :text => "This is a hide comment", :format => "json"
assert_response :forbidden
delete :destroy, :id => open_note_with_comment.id, :text => "This is a hide comment", :format => "json"
assert_response :success
delete :destroy, :id => open_note_with_comment.id, :text => "This is a hide comment", :format => "json"
assert_response :success
assert_equal 2, js["properties"]["comments"].count
assert_equal "hidden", js["properties"]["comments"].last["action"]
assert_equal "This is a hide comment", js["properties"]["comments"].last["text"]
assert_equal 2, js["properties"]["comments"].count
assert_equal "hidden", js["properties"]["comments"].last["action"]
assert_equal "This is a hide comment", js["properties"]["comments"].last["text"]
delete :destroy, :id => 12345, :format => "json"
assert_response :unauthorized
delete :destroy, :id => 12345, :format => "json"
assert_response :unauthorized
delete :destroy, :id => 12345, :format => "json"
assert_response :forbidden
delete :destroy, :id => 12345, :format => "json"
assert_response :forbidden
delete :destroy, :id => 12345, :format => "json"
assert_response :not_found
delete :destroy, :id => 12345, :format => "json"
assert_response :not_found
assert_response :success
assert_select "table.note_list tr", :count => 2
get :mine, :display_name => "non-existent"
assert_response :not_found
assert_response :success
assert_select "table.note_list tr", :count => 2
get :mine, :display_name => "non-existent"
assert_response :not_found