subscriptions_controller_spec.rb 766 B

1234567891011121314151617181920212223242526272829303132
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe Admin::SubscriptionsController, type: :controller do
  4. render_views
  5. describe 'GET #index' do
  6. around do |example|
  7. default_per_page = Subscription.default_per_page
  8. Subscription.paginates_per 1
  9. example.run
  10. Subscription.paginates_per default_per_page
  11. end
  12. before do
  13. sign_in Fabricate(:user, admin: true), scope: :user
  14. end
  15. it 'renders subscriptions' do
  16. Fabricate(:subscription)
  17. specified = Fabricate(:subscription)
  18. get :index
  19. subscriptions = assigns(:subscriptions)
  20. expect(subscriptions.count).to eq 1
  21. expect(subscriptions[0]).to eq specified
  22. expect(response).to have_http_status(200)
  23. end
  24. end
  25. end