Fix flaky editor spec & change dev configs (#3022)
* Update .simplecov * Downgrade factory_bot_rails * Update flaky test * Update .travis.yml * Update user_edits_an_article_spec
This commit is contained in:
parent
6bbdb73019
commit
cea77663ad
7 changed files with 31 additions and 31 deletions
18
.simplecov
18
.simplecov
|
|
@ -1,9 +1,11 @@
|
|||
SimpleCov.start "rails" do
|
||||
add_filter "/spec/"
|
||||
add_filter "/dashboards/"
|
||||
add_filter "/app/controllers/admin/"
|
||||
add_filter "/app/controllers/internal/"
|
||||
add_filter "/app/black_box/"
|
||||
add_filter "/app/fields/"
|
||||
add_filter "/app/views/admin/"
|
||||
if ENV["COVERAGE"]
|
||||
SimpleCov.start "rails" do
|
||||
add_filter "/spec/"
|
||||
add_filter "/dashboards/"
|
||||
add_filter "/app/controllers/admin/"
|
||||
add_filter "/app/controllers/internal/"
|
||||
add_filter "/app/black_box/"
|
||||
add_filter "/app/fields/"
|
||||
add_filter "/app/views/admin/"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ env:
|
|||
- RAILS_ENV=test
|
||||
- CC_TEST_REPORTER_ID=f39e060a8b1a558ebd8aff75d5b9760bf1ae98f3f85d628ae28814f3c66438cd
|
||||
- DATABASE_URL=postgres://postgres@localhost/
|
||||
- COVERAGE=true
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
|
|
|||
2
Gemfile
2
Gemfile
|
|
@ -139,7 +139,7 @@ end
|
|||
|
||||
group :test do
|
||||
gem "approvals", "~> 0.0" # A library to make it easier to do golden-master style testing in Ruby
|
||||
gem "factory_bot_rails", "~> 5.0" # factory_bot is a fixtures replacement with a straightforward definition syntax, support for multiple build strategies
|
||||
gem "factory_bot_rails", "~> 4.11" # factory_bot is a fixtures replacement with a straightforward definition syntax, support for multiple build strategies
|
||||
gem "launchy", "~> 2.4" # Launchy is helper class for launching cross-platform applications in a fire and forget manner.
|
||||
gem "pundit-matchers", "~> 1.6" # A set of RSpec matchers for testing Pundit authorisation policies
|
||||
gem "rspec-retry", "~> 0.6" # retry intermittently failing rspec examples
|
||||
|
|
|
|||
12
Gemfile.lock
12
Gemfile.lock
|
|
@ -308,11 +308,11 @@ GEM
|
|||
eventmachine (1.2.5)
|
||||
excon (0.64.0)
|
||||
execjs (2.7.0)
|
||||
factory_bot (5.0.2)
|
||||
activesupport (>= 4.2.0)
|
||||
factory_bot_rails (5.0.2)
|
||||
factory_bot (~> 5.0.2)
|
||||
railties (>= 4.2.0)
|
||||
factory_bot (4.11.1)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_bot_rails (4.11.1)
|
||||
factory_bot (~> 4.11.1)
|
||||
railties (>= 3.0.0)
|
||||
faker (1.9.3)
|
||||
i18n (>= 0.7)
|
||||
faraday (0.15.4)
|
||||
|
|
@ -869,7 +869,7 @@ DEPENDENCIES
|
|||
emoji_regex (~> 2.0)
|
||||
envied (~> 0.9)
|
||||
erb_lint (~> 0.0)
|
||||
factory_bot_rails (~> 5.0)
|
||||
factory_bot_rails (~> 4.11)
|
||||
faker (~> 1.9)
|
||||
fastly (~> 1.15)
|
||||
fastly-rails (~> 0.8)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ require "pundit/matchers"
|
|||
require "pundit/rspec"
|
||||
require "webmock/rspec"
|
||||
require "test_prof/recipes/rspec/before_all"
|
||||
require "test_prof/recipes/rspec/let_it_be"
|
||||
|
||||
# Requires supporting ruby files with custom matchers and macros, etc, in
|
||||
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
||||
|
|
|
|||
|
|
@ -1,36 +1,36 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe "Editing with an editor", type: :system do
|
||||
let!(:user) { create(:user) }
|
||||
let!(:template) { file_fixture("article_published.txt").read }
|
||||
let(:article) { create(:article, user: user, body_markdown: template) }
|
||||
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 clicks the edit button", js: true, retry: 3 do
|
||||
it "user clicks the edit button" do
|
||||
link = "/#{user.username}/#{article.slug}"
|
||||
visit link
|
||||
find("#action-space").click
|
||||
expect(page).to have_current_path(link + "/edit")
|
||||
end
|
||||
|
||||
it "user previews their changes", js: true, retry: 3 do
|
||||
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", js: true, retry: 3 do
|
||||
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", js: true, retry: 3 do
|
||||
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")
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe "Views an article", type: :system 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
|
||||
let!(:timestamp) { "2019-03-04T10:00:00Z" }
|
||||
let_it_be(:user) { create(:user) }
|
||||
let_it_be(:article, reload: true) { create(:article, user: user) }
|
||||
let(:timestamp) { "2019-03-04T10:00:00Z" }
|
||||
|
||||
before do
|
||||
sign_in user
|
||||
|
|
@ -18,7 +14,7 @@ RSpec.describe "Views an article", type: :system do
|
|||
expect(page).to have_content(article.title)
|
||||
end
|
||||
|
||||
it "shows comments", js: true, retry: 3 do
|
||||
it "shows comments", js: true do
|
||||
create_list(:comment, 3, commentable: article)
|
||||
visit "/#{user.username}/#{article.slug}"
|
||||
expect(page).to have_selector(".single-comment-node", visible: true, count: 3)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue