From 7f5df4db9b47e9a6efb33f5c557832c2439286ba Mon Sep 17 00:00:00 2001 From: Nenad Vujicic Date: Mon, 11 Nov 2024 14:27:24 +0100 Subject: [PATCH] Added unit test for notes with tags Added NotesControllerTest#test_note_with_tags unit test for testing cases when note has tags and comment (description). Internally, new note is created with comment (description) and several tags and then rendered in sidebar. Existence of appropriate HTML tags for notes, comment (description) and tags is checked. --- test/controllers/notes_controller_test.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/controllers/notes_controller_test.rb b/test/controllers/notes_controller_test.rb index 71dfa42bae..b5b6e68041 100644 --- a/test/controllers/notes_controller_test.rb +++ b/test/controllers/notes_controller_test.rb @@ -67,6 +67,27 @@ def test_index_success assert_response :not_found end + def test_note_with_tags + user = create(:user) + + note = create(:note) + create(:note_comment, :note => note, :author => user, :body => "Note description") + create(:note_tag, :note => note, :k => "created_by", :v => "OSM_TEST") + create(:note_tag, :note => note, :k => "source", :v => "OSM_TEST_SURVEY") + + sidebar_browse_check :note_path, note.id, "notes/show" + assert_dom "h2", :text => "Unresolved note ##{note.id}" + assert_dom "p", :text => "Note description" + assert_dom "tr" do + assert_dom "th", :text => "created_by" + assert_dom "td", :text => "OSM_TEST" + end + assert_dom "tr" do + assert_dom "th", :text => "source" + assert_dom "td", :text => "OSM_TEST_SURVEY" + end + end + def test_index_paged user = create(:user)