mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-25 17:36:14 +08:00
28 lines
801 B
Ruby
28 lines
801 B
Ruby
|
require 'rails_helper'
|
||
|
|
||
|
describe ClientApi::NotificationsController, type: :controller do
|
||
|
login_user
|
||
|
let(:notification) { create :notification }
|
||
|
let(:user_notification) do
|
||
|
create :user_notification,
|
||
|
user: User.first,
|
||
|
notification: notification
|
||
|
end
|
||
|
|
||
|
describe '#recent_notifications' do
|
||
|
it 'returns a list of notifications' do
|
||
|
get :recent_notifications, format: :json
|
||
|
expect(response).to be_success
|
||
|
expect(response).to render_template('client_api/notifications/index')
|
||
|
end
|
||
|
end
|
||
|
|
||
|
describe '#unreaded_notifications_number' do
|
||
|
it 'returns a number of unreaded notifications' do
|
||
|
get :unreaded_notifications_number, format: :json
|
||
|
expect(response).to be_success
|
||
|
expect(response.body).to include('count')
|
||
|
end
|
||
|
end
|
||
|
end
|