From faa483b9dc27f2f80f61a721fd301e2c6fbb1fa7 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_displaying_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..3a39f7e91b 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_displaying_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 => "삭ÒX~`!@#$%^&*()-=_+,<.>/?;:'\"[{}]\\|傥4ր", :v => "Ƭ߯ĸá~`!@#$%^&*()-=_+,<.>/?;:'\"[{}]\\|؇Őϋ") + + 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 => "삭ÒX~`!@#$%^&*()-=_+,<.>/?;:'\"[{}]\\|傥4ր" + assert_dom "td", :text => "Ƭ߯ĸá~`!@#$%^&*()-=_+,<.>/?;:'\"[{}]\\|؇Őϋ" + end + end + def test_index_paged user = create(:user)