Add spec for publishing a comment from the comments box for a draft

This commit is contained in:
Amaia Castro
2017-01-20 11:32:31 +01:00
parent 1af047089f
commit 47b35a8149
2 changed files with 18 additions and 2 deletions

View File

@@ -45,7 +45,7 @@
<% end %>
<% if @process.open_phase?(:allegations) %>
<a class="button strong publish-comment" title="Publicar comentario" href="#">Publicar comentario</a>
<a class="button strong publish-comment" href="#"><%= t('legislation.annotations.comments.publish_comment') %></a>
<% end %>
<% if @process.open_phase?(:allegations) %>

View File

@@ -171,7 +171,7 @@ feature 'Legislation Draft Versions' do
expect(page).to have_content "this is my annotation"
end
scenario 'Search' do
scenario 'View annotations and comments' do
draft_version = create(:legislation_draft_version, :published, body: Faker::Lorem.paragraph)
annotation1 = create(:legislation_annotation, draft_version: draft_version, text: "my annotation", ranges: [{"start"=>"/p[1]", "startOffset"=>5, "end"=>"/p[1]", "endOffset"=>10}])
annotation2 = create(:legislation_annotation, draft_version: draft_version, text: "my other annotation", ranges: [{"start"=>"/p[1]", "startOffset"=>12, "end"=>"/p[1]", "endOffset"=>19}])
@@ -185,6 +185,22 @@ feature 'Legislation Draft Versions' do
all(".annotator-hl")[1].trigger('click')
expect(page).to have_content "my other annotation"
end
scenario "Publish new comment for an annotation from comments box" do
draft_version = create(:legislation_draft_version, :published, body: Faker::Lorem.paragraph)
annotation = create(:legislation_annotation, draft_version: draft_version, text: "my annotation", ranges: [{"start"=>"/p[1]", "startOffset"=>5, "end"=>"/p[1]", "endOffset"=>10}])
visit legislation_process_draft_version_path(draft_version.process, draft_version)
expect(page).to have_css ".annotator-hl"
first(:css, ".annotator-hl").click
expect(page).to have_content "my annotation"
click_link "Publish Comment"
fill_in "comment[body]", with: "My interesting comment"
click_button "Publish comment"
expect(page).to have_content "My interesting comment"
end
end
context "Annotations page" do