* Create .travis.yml * Update .travis.yml * Add postgresql to travis * Change travis's postgresql version * Add chrome addon to travis * Adjust travis config --skip-ci * Change travis dist * Change travis to use Chrome --skip-ci * Use IntegraitonHelpers --skip-ci * Add no-sandbox option to headless chrome * Add sudo to travis * Fix broken spec * Update travis.yml * Change how travis store bundler cache * Update chromedriver command * Add CodeClimate to travis --skip-ci * Remove deadcode --skip-ci * Remove dead code * Change rspec-retry back to 3 * Add deploy script to travis * Safelist only master for Travis --skip-ci
38 lines
1.1 KiB
Ruby
38 lines
1.1 KiB
Ruby
require "rails_helper"
|
|
|
|
feature "Editing with an editor" do
|
|
let(:user) { create(:user) }
|
|
let(:dir) { "../support/fixtures/sample_article.txt" }
|
|
let(:template) { File.read(File.join(File.dirname(__FILE__), dir)) }
|
|
let(:article) do
|
|
create(:article,
|
|
user_id: user.id,
|
|
body_markdown: template.gsub("false", "true"),
|
|
body_html: "")
|
|
end
|
|
|
|
background do
|
|
sign_in user
|
|
end
|
|
|
|
scenario "user click the edit-post button", js: true, retry: 3 do
|
|
link = "/#{user.username}/#{article.slug}"
|
|
visit link
|
|
find("#action-space").click
|
|
expect(page).to have_current_path(link + "/edit")
|
|
end
|
|
|
|
scenario "user preview their edit post" do
|
|
visit "/#{user.username}/#{article.slug}/edit"
|
|
click_button("previewbutt")
|
|
expect(page).to have_text(template[-200..-1])
|
|
end
|
|
|
|
scenario "user update their post" do
|
|
visit "/#{user.username}/#{article.slug}/edit"
|
|
fill_in "article_body_markdown", with: template.gsub("true", "false")
|
|
click_button("article-submit")
|
|
expect(page).to have_text("Unpublished Post.")
|
|
end
|
|
end
|
|
|