* Initial automatic cleanup with rubocop * Fix syntax error introduced by rubocop * Cleanup seeds file * Cleanup lib folder * Exclude bin folder because it contains auto generated files * Make Rubocop a little bit more chatty * Block length should not include comments in the count * Cleanup config folder * Cleanup specs * Updated Rubocop version and generated a todo file * Fix broken ArticlesApi spec * Fix tests * Restored rubocop pre-commit hook
24 lines
547 B
Ruby
24 lines
547 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "Deleting Article", js: true do
|
|
let(:author) { create(:user) }
|
|
let(:article) { create(:article, user_id: author.id) }
|
|
|
|
def delete_article_via_dashboard
|
|
visit "/dashboard"
|
|
delete_link = find_link("DELETE")
|
|
delete_link.click
|
|
second_link = find_link("DELETE")
|
|
second_link.click
|
|
end
|
|
|
|
before do
|
|
article
|
|
end
|
|
|
|
it "author of article deletes own article" do
|
|
sign_in author
|
|
delete_article_via_dashboard
|
|
expect(page).to have_text("Write your first post now")
|
|
end
|
|
end
|