docbrown/spec/requests/comments_update_spec.rb
Anna Buianova 01456fe029 [deploy] Finalize deleting user associations (#5624)
* Prepare factories and associations for Users::DeleteActivity specs

* Altered user associations, delete the needed associations in Users::DeleteActivity

* Moved and refined user deletion spec

* Removed useless commented user associations

* Refactored BackupData factory

* Refactored ProfilePin factory

* Refactored Reaction factory

* Fixed specs: Keep default _type in factories or specify it in tests

* Ok, notes shouldn't be deleted on user deletion

* Fixed creating reactable for specs

* Specify commentable/commentable_type explicitly when creating data for tests

* Fixed typo in the comments spec

* Removed unnneeded space

* Added aggregate_failures for testing user associations deletion

* Keep feedback_messages while deleting user activities
2020-01-23 11:29:47 -05:00

20 lines
605 B
Ruby

require "rails_helper"
RSpec.describe "CommentsUpdate", type: :request do
let(:user) { create(:user) }
let(:article) { create(:article, user_id: user.id) }
let(:comment) { create(:comment, user_id: user.id, commentable: article) }
before do
sign_in user
Notification.send_new_comment_notifications_without_delay(comment)
end
it "updates ordinary article with proper params" do
new_body = "NEW TITLE #{rand(100)}"
put "/comments/#{comment.id}", params: {
comment: { body_markdown: new_body }
}
expect(Comment.last.processed_html).to include(new_body)
end
end