School dashboard is protected by district-level authentication

[Finishes #179513281]
This commit is contained in:
Alex Basson 2021-09-09 11:13:10 -04:00
parent 813efca493
commit 771c1c3209
2 changed files with 24 additions and 2 deletions

View file

@ -1,14 +1,27 @@
require "rails_helper"
RSpec.feature "School dashboard", type: feature do
feature "School dashboard", type: feature do
let(:district) { District.create name: 'Winchester' }
let(:school) {
School.create name: 'Winchester High School', slug: 'winchester-high-school', district: district
}
scenario "User authentication fails" do
page.driver.browser.basic_authorize('wrong username', 'wrong password')
visit "/districts/winchester/schools/#{school.slug}/dashboard?year=2020-21"
expect(page).not_to have_text(school.name)
end
scenario "User views a school dashboard" do
page.driver.browser.basic_authorize(username, password)
visit "/districts/winchester/schools/#{school.slug}/dashboard?year=2020-21"
expect(page).to have_text(school.name)
end
let(:username) { 'winchester' }
let(:password) { 'winchester!' }
end