docbrown/spec/services/read_notifications_service_spec.rb
2019-11-20 13:01:30 -05:00

15 lines
430 B
Ruby

require "rails_helper"
RSpec.describe ReadNotificationsService, type: :service 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