docbrown/spec/services/read_notifications_service_spec.rb
Andy Zhao 5ace9a5fc9 Organization Notifications (#1762)
* Add spec for org reaction notification

* Add organization_id to notifications

* Add validations for user and org IDs

* Move comment json_data out of loop

* Use actual column names instead

* Add organization filters

* Remove extra text-align

* Add organization filtering

* Refactor to reduce complexity

* Add receiver argument to handle orgs

* Add has_many notifications for orgs

* Add follow notifications for orgs

* Add comment notifications for orgs

* Rename some tests for specificity

* Add mark org notifications as read functionality

* Add radix to parseInt

* Define json_data outside of loop

* Notify org followers of a new post as well

* Move test to proper location

* Add test for aggregated method

* Make send org reaction notification more readable

* Test the rest of the notification model

* Refactor tag adjustment spec

* Fix extra html
2019-02-25 14:25:37 -08:00

15 lines
414 B
Ruby

require "rails_helper"
RSpec.describe ReadNotificationsService do
let(:user) { create(:user) }
let(:mock) { instance_double(NotificationCounter) }
before do
allow(NotificationCounter).to receive(:new) { mock }
allow(mock).to receive(:set_to_zero).and_return(true)
end
it "returns read when #mark_as_read is called" do
expect(described_class.new(user).mark_as_read).to eq("read")
end
end