mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-08 23:18:18 -07:00
Visiting /districts/winchester/schools/winchester-high-school/dashboard displays an empty dashboard
This commit is contained in:
parent
e622a01dd0
commit
813efca493
5 changed files with 36 additions and 1 deletions
13
app/controllers/dashboard_controller.rb
Normal file
13
app/controllers/dashboard_controller.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class DashboardController < ApplicationController
|
||||
|
||||
def index
|
||||
@school = School.find_by_slug school_slug
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def school_slug
|
||||
params[:school_id]
|
||||
end
|
||||
|
||||
end
|
||||
1
app/views/dashboard/index.html.erb
Normal file
1
app/views/dashboard/index.html.erb
Normal file
|
|
@ -0,0 +1 @@
|
|||
<h1><%= @school.name %></h1>
|
||||
|
|
@ -2,7 +2,11 @@ Rails.application.routes.draw do
|
|||
resources :question_lists
|
||||
resources :questions
|
||||
resources :categories
|
||||
resources :districts
|
||||
resources :districts do
|
||||
resources :schools, only: [:index, :show] do
|
||||
resources :dashboard, only: [:index]
|
||||
end
|
||||
end
|
||||
resources :experiments
|
||||
|
||||
resources :schools do
|
||||
|
|
|
|||
14
spec/features/school_dashboard_feature_spec.rb
Normal file
14
spec/features/school_dashboard_feature_spec.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.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 views a school dashboard" do
|
||||
visit "/districts/winchester/schools/#{school.slug}/dashboard?year=2020-21"
|
||||
|
||||
expect(page).to have_text(school.name)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
require 'capybara/rspec'
|
||||
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
||||
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
||||
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
||||
|
|
@ -47,6 +48,8 @@ RSpec.configure do |config|
|
|||
# triggering implicit auto-inclusion in groups with matching metadata.
|
||||
config.shared_context_metadata_behavior = :apply_to_host_groups
|
||||
|
||||
config.include Capybara::DSL
|
||||
|
||||
# The settings below are suggested to provide a good initial experience
|
||||
# with RSpec, but feel free to customize to your heart's content.
|
||||
=begin
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue