end
assert_response :gone
- closed_note_with_comment = create(:note_with_comments, :status => "closed", :closed_at => Time.now.utc)
+ closed_note_with_comment = create(:note_with_comments, :closed)
assert_no_difference "NoteComment.count" do
post comment_api_note_path(:id => closed_note_with_comment, :text => "This is an additional comment"), :headers => auth_header
post close_api_note_path(:id => hidden_note_with_comment), :headers => auth_header
assert_response :gone
- closed_note_with_comment = create(:note_with_comments, :status => "closed", :closed_at => Time.now.utc)
+ closed_note_with_comment = create(:note_with_comments, :closed)
post close_api_note_path(:id => closed_note_with_comment), :headers => auth_header
assert_response :conflict
end
def test_reopen_success
- closed_note_with_comment = create(:note_with_comments, :status => "closed", :closed_at => Time.now.utc)
+ closed_note_with_comment = create(:note_with_comments, :closed)
user = create(:user)
post reopen_api_note_path(:id => closed_note_with_comment, :text => "This is a reopen comment", :format => "json")
assert_equal "Feature", js["type"]
assert_equal closed_note_with_comment.id, js["properties"]["id"]
assert_equal "open", js["properties"]["status"]
- assert_equal 2, js["properties"]["comments"].count
+ assert_equal 3, 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 user.display_name, js["properties"]["comments"].last["user"]
assert_equal "Feature", js["type"]
assert_equal closed_note_with_comment.id, js["properties"]["id"]
assert_equal "open", js["properties"]["status"]
- assert_equal 2, js["properties"]["comments"].count
+ assert_equal 3, 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 user.display_name, js["properties"]["comments"].last["user"]
end
def test_index_closed
- create(:note_with_comments, :status => "closed", :closed_at => Time.now.utc - 5.days)
- create(:note_with_comments, :status => "closed", :closed_at => Time.now.utc - 100.days)
+ create(:note_with_comments, :closed, :closed_at => Time.now.utc - 5.days)
+ create(:note_with_comments, :closed, :closed_at => Time.now.utc - 100.days)
create(:note_with_comments, :status => "hidden")
create(:note_with_comments)
end
def test_index_bad_params
+ get api_notes_path
+ assert_response :bad_request
+ assert_equal "The parameter bbox is required", @response.body
+
get api_notes_path(:bbox => "-2.5,-2.5,2.5")
assert_response :bad_request