2017-10-02 20:51:54 +08:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2018-01-31 19:05:45 +08:00
|
|
|
describe ClientApi::NotificationsController, type: :controller, broken: true do
|
2017-10-02 20:51:54 +08:00
|
|
|
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
|
2017-10-06 16:45:22 +08:00
|
|
|
get :unread_notifications_count, format: :json
|
2017-10-02 20:51:54 +08:00
|
|
|
expect(response).to be_success
|
|
|
|
expect(response.body).to include('count')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|