docbrown/spec/system/resource_admin/admin_dashboard_presented_spec.rb
Josh Puetz 1c566e0ec4
[deploy] Move /internal to `/admin (#9639)
* First draft - all the big changes

* Changing some more references to 'internal'

* Relocate internal request tests to admin

* Relocate internal system tests to admin

* Fix trailing space

* Test fix

* Move queries from internal to admin

* Docs updates

* Rename internal stimuls controllers to admin (plus docs)

* Rename admin layout

* Fix routing after rebase

* Fixes for latest added admin interfaces

* Serviceworker ignore paths
2020-08-07 10:36:26 -04:00

27 lines
814 B
Ruby

require "rails_helper"
RSpec.describe "Admin dashboard is presented", type: :system do
let(:admin) { build(:user, :super_admin) }
let(:user) { build_stubbed(:user) }
before { Bullet.raise = false }
after { Bullet.raise = true }
it "loads the admin dashboard articles view", js: true do
sign_in admin
visit "/resource_admin"
expect(page).to have_content("Articles")
end
it "loads the admin dashboard podcasts view", js: true do
sign_in admin
visit "/resource_admin/podcasts"
expect(page).to have_content("Podcast Episodes")
end
it "fails to load admin view for unauthorized users" do
expect { visit "/resource_admin" }.to raise_error(Pundit::NotAuthorizedError)
expect { visit "/resource_admin/podcasts" }.to raise_error(Pundit::NotAuthorizedError)
end
end