Skip to content

Commit

Permalink
Added unit test for notes with tags
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nenad-vujicic committed Nov 19, 2024
1 parent 3c78b68 commit 7f5df4d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/controllers/notes_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 7f5df4d

Please sign in to comment.