about summary refs log tree commit diff
path: root/spec/controllers/admin/pubsubhubbub_controller_spec.rb
blob: c8e8e7a8424320a4f10bbc045f680e5c43cbf94c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe Admin::PubsubhubbubController, type: :controller do
  render_views

  describe 'GET #index' do
    around do |example|
      default_per_page = Subscription.default_per_page
      Subscription.paginates_per 1
      example.run
      Subscription.paginates_per default_per_page
    end

    before do
      sign_in Fabricate(:user, admin: true), scope: :user
    end

    it 'renders subscriptions' do
      Fabricate(:subscription)
      specified = Fabricate(:subscription)

      get :index

      subscriptions = assigns(:subscriptions)
      expect(subscriptions.count).to eq 1
      expect(subscriptions[0]).to eq specified

      expect(response).to have_http_status(:success)
    end
  end
end