docbrown/spec/features/user_deletes_an_article_spec.rb
Andy Zhao 2db2dd1e5a WIP Refactor/notifications (#1131)
* Add new columns to notifications table

* Remove stream from notifications and add new methods

* Turn off moderation comment notifications

* Add notifiable_type index to migration

* Stop creation of Stream-based notification model instances

* Add notification model create hooks

* Add badge achievement notification creation hook

* Fix some specs

* Add missing @ symbol

* Fix for tests and rename a few things

* forgot to uncomment code sigh
2018-11-19 16:09:02 -05:00

24 lines
639 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
Notification.send_to_followers(article, [author], "Published")
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