docbrown/spec/system/articles/user_edits_an_article_spec.rb
Vaidehi Joshi d2ef01ecc2
Remove Percy (#8915)
We are no longer using the Percy service, so this code is not required anymore.
Removes the percy agent, the gem, and all references to Percy.snapshot and percy: true.
2020-06-25 11:19:58 -07:00

32 lines
1 KiB
Ruby

require "rails_helper"
RSpec.describe "Editing with an editor", type: :system, js: true do
let_it_be(:template) { file_fixture("article_published.txt").read }
let_it_be(:user) { create(:user) }
let_it_be(:article, reload: true) { create(:article, user: user, body_markdown: template) }
before do
sign_in user
end
it "user previews their changes" do
visit "/#{user.username}/#{article.slug}/edit"
fill_in "article_body_markdown", with: template.gsub("Suspendisse", "Yooo")
click_button("Preview")
expect(page).to have_text("Yooo")
end
it "user updates their post" do
visit "/#{user.username}/#{article.slug}/edit"
fill_in "article_body_markdown", with: template.gsub("Suspendisse", "Yooo")
click_button("Save changes")
expect(page).to have_text("Yooo")
end
it "user unpublishes their post" do
visit "/#{user.username}/#{article.slug}/edit"
fill_in "article_body_markdown", with: template.gsub("true", "false")
click_button("Save changes")
expect(page).to have_text("Unpublished Post.")
end
end