docbrown/spec/requests/notification_counts_spec.rb
Anna Buianova 7d053471f8
Rubocop fixes in spec/requests (#18946)
* Rubocop fixes in spec/requests

* Fixed spec/requests/api/v0/articles_spec.rb

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2023-01-12 19:10:16 +03:00

22 lines
587 B
Ruby

require "rails_helper"
RSpec.describe "NotificationCounts" do
let(:user) { create(:user) }
let(:following_user) { create(:user) }
describe "GET /notifications/counts" do
it "returns count if signed in" do
sign_in user
follow_instance = following_user.follow(user)
Notification.send_new_follower_notification_without_delay(follow_instance)
get "/notifications/counts"
expect(response.body).to eq("1")
end
it "returns 0 if no user is present" do
get "/notifications/counts"
expect(response.body).to eq("0")
end
end
end