From 5bb9890c091479194a9f7f6818e8fea2d7370afb Mon Sep 17 00:00:00 2001 From: Fernando Valverde Date: Wed, 26 Feb 2020 09:21:09 -0600 Subject: [PATCH] Adds administrate gem CSS & JS assets to Sprockets Manifest (#6291) [deploy] * Adds administrate gem application.css & applicatiion.js to Sprockets manifest * Adds admin tests --- app/assets/config/manifest.js | 2 ++ .../admin/admin_dashboard_presented_spec.rb | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 spec/system/admin/admin_dashboard_presented_spec.rb diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 5fbbb5019..bca3cc0a1 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -4,3 +4,5 @@ //= link_directory ../stylesheets .css //= link internal/layout.css //= link s3_direct_upload.js +// = link administrate/application.css +// = link administrate/application.js diff --git a/spec/system/admin/admin_dashboard_presented_spec.rb b/spec/system/admin/admin_dashboard_presented_spec.rb new file mode 100644 index 000000000..e12dbd2c1 --- /dev/null +++ b/spec/system/admin/admin_dashboard_presented_spec.rb @@ -0,0 +1,23 @@ +require "rails_helper" + +RSpec.describe "Admin dashboard is presented", type: :system do + let(:admin) { create(:user, :super_admin) } + let(:user) { create(:user) } + + before { Bullet.raise = false } + after { Bullet.raise = true } + + it "loads the admin dashboard view" do + sign_in admin + visit "/admin" + expect(page).to have_content("Articles") + + visit "/admin/podcasts" + expect(page).to have_content("Podcast Episodes") + end + + it "fails to load admin view for unauthorized users" do + expect { visit "/admin" }.to raise_error(Pundit::NotAuthorizedError) + expect { visit "/admin/podcasts" }.to raise_error(Pundit::NotAuthorizedError) + end +end