From b14e5522cd9342ee0365a23d427edeb945e50313 Mon Sep 17 00:00:00 2001 From: Anna Buianova Date: Wed, 30 Mar 2022 22:29:36 +0300 Subject: [PATCH] Fixed hiding 'Click to edit' link for drafts (#17051) * Fixed hiding 'Click to edit' link for drafts * Improve "click to edit" link spec Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com> * Make the expectation more clear Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com> Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com> --- app/views/articles/show.html.erb | 2 +- spec/system/articles/user_visits_an_article_spec.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/articles/show.html.erb b/app/views/articles/show.html.erb index 6d3883835..095527975 100644 --- a/app/views/articles/show.html.erb +++ b/app/views/articles/show.html.erb @@ -69,7 +69,7 @@
<%= t("views.articles.unpublished.subtitle") %><%= t("views.articles.unpublished.text") %> <% if user_signed_in? %> - <%= t("views.articles.unpublished.edit") %> + <% end %>
<% end %> diff --git a/spec/system/articles/user_visits_an_article_spec.rb b/spec/system/articles/user_visits_an_article_spec.rb index 1176fad09..a0c76fcf6 100644 --- a/spec/system/articles/user_visits_an_article_spec.rb +++ b/spec/system/articles/user_visits_an_article_spec.rb @@ -158,9 +158,9 @@ RSpec.describe "Views an article", type: :system do let(:query_params) { "?preview=#{article.password}" } let(:article_user) { create(:user) } - it "does not the article edit link" do + it "renders the article edit link" do visit article_path - expect(page.body).not_to include('display: inline-block;">Click to edit') + expect(page.body).to include('display: none;">Click to edit') end end @@ -168,10 +168,10 @@ RSpec.describe "Views an article", type: :system do let(:query_params) { "?preview=#{article.password}" } let(:article_user) { user } - it "does not the article edit link" do + it "does not render the article edit link" do sign_out user visit article_path - expect(page.body).not_to include('display: inline-block;">Click to edit') + expect(page.body).not_to include("Click to edit") end end