Visiting /districts/winchester/schools/winchester-high-school/dashboard displays an empty dashboard

pull/1/head
Alex Basson 4 years ago
parent e622a01dd0
commit 813efca493

@ -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

@ -0,0 +1 @@
<h1><%= @school.name %></h1>

@ -2,7 +2,11 @@ Rails.application.routes.draw do
resources :question_lists resources :question_lists
resources :questions resources :questions
resources :categories resources :categories
resources :districts resources :districts do
resources :schools, only: [:index, :show] do
resources :dashboard, only: [:index]
end
end
resources :experiments resources :experiments
resources :schools do resources :schools do

@ -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 # 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`. # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause # 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. # triggering implicit auto-inclusion in groups with matching metadata.
config.shared_context_metadata_behavior = :apply_to_host_groups config.shared_context_metadata_behavior = :apply_to_host_groups
config.include Capybara::DSL
# The settings below are suggested to provide a good initial experience # The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content. # with RSpec, but feel free to customize to your heart's content.
=begin =begin

Loading…
Cancel
Save