mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-13 01:10:39 -07:00
Extract legacy parts of the codebase into its own module
This commit is contained in:
parent
cf6e80ce6b
commit
413096dfe2
269 changed files with 5549 additions and 5279 deletions
|
|
@ -1,30 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "categories/edit", type: :view do
|
||||
before(:each) do
|
||||
@category = assign(:category, Category.create!(
|
||||
:name => "MyString",
|
||||
:blurb => "MyString",
|
||||
:description => "MyText",
|
||||
:external_id => "MyString",
|
||||
:parent_category_id => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit category form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", category_path(@category), "post" do
|
||||
|
||||
assert_select "input#category_name[name=?]", "category[name]"
|
||||
|
||||
assert_select "input#category_blurb[name=?]", "category[blurb]"
|
||||
|
||||
assert_select "textarea#category_description[name=?]", "category[description]"
|
||||
|
||||
assert_select "input#category_external_id[name=?]", "category[external_id]"
|
||||
|
||||
assert_select "input#category_parent_category_id[name=?]", "category[parent_category_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "categories/index", type: :view do
|
||||
before(:each) do
|
||||
assign(:categories, [
|
||||
Category.create!(
|
||||
:name => "Name",
|
||||
:blurb => "Blurb",
|
||||
:description => "MyText",
|
||||
:external_id => "External",
|
||||
:parent_category_id => 2
|
||||
),
|
||||
Category.create!(
|
||||
:name => "Name",
|
||||
:blurb => "Blurb",
|
||||
:description => "MyText",
|
||||
:external_id => "External",
|
||||
:parent_category_id => 2
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of categories" do
|
||||
render(template: "categories/index")
|
||||
assert_select "tr>td", :text => "Name".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Blurb".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "MyText".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "External".to_s, :count => 2
|
||||
assert_select "tr>td", :text => 2.to_s, :count => 2
|
||||
end
|
||||
end
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "categories/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:category, Category.new(
|
||||
:name => "MyString",
|
||||
:blurb => "MyString",
|
||||
:description => "MyText",
|
||||
:external_id => "MyString",
|
||||
:parent_category_id => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new category form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", categories_path, "post" do
|
||||
|
||||
assert_select "input#category_name[name=?]", "category[name]"
|
||||
|
||||
assert_select "input#category_blurb[name=?]", "category[blurb]"
|
||||
|
||||
assert_select "textarea#category_description[name=?]", "category[description]"
|
||||
|
||||
assert_select "input#category_external_id[name=?]", "category[external_id]"
|
||||
|
||||
assert_select "input#category_parent_category_id[name=?]", "category[parent_category_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,20 +1,78 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "categories/show", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create(name: 'School'))
|
||||
@category = assign(:category, Category.create!(
|
||||
:name => "Category",
|
||||
:description => "MyText",
|
||||
:parent_category => Category.create(name: 'Teachers And The Teaching Environment')
|
||||
))
|
||||
@school_category = assign(:school_category, SchoolCategory.create(school: @school, category: @category))
|
||||
describe 'categories/show.html.erb' do
|
||||
before :each do
|
||||
academic_year = create(:academic_year, range: '1989-90')
|
||||
school = create(:school, name: 'Best School')
|
||||
|
||||
category = create(:category, name: 'Some Category', description: 'Some description of the category')
|
||||
category_presenter = CategoryPresenter.new(category: category)
|
||||
|
||||
subcategory1 = create(:subcategory, category: category, name: 'A subcategory', description: 'Some description of the subcategory')
|
||||
subcategory2 = create(:subcategory_with_measures, category: category, name: 'Another subcategory', description: 'Another description of the subcategory')
|
||||
|
||||
measure1 = create(:measure, subcategory: subcategory1, watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
|
||||
survey_item1 = create(:student_survey_item, measure: measure1)
|
||||
create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: survey_item1, academic_year: academic_year, school: school, likert_score: 1)
|
||||
|
||||
measure2 = create(:measure, name: 'The second measure name', description: 'The second measure description', subcategory: subcategory1, watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
|
||||
student_survey_item = create(:student_survey_item, measure: measure2, prompt: "Some prompt for student data")
|
||||
create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: student_survey_item, academic_year: academic_year, school: school, likert_score: 5)
|
||||
|
||||
teacher_survey_item = create(:teacher_survey_item, measure: measure2, prompt: "Some prompt for teacher data")
|
||||
create_list(:survey_item_response, SurveyItemResponse::TEACHER_RESPONSE_THRESHOLD, survey_item: teacher_survey_item, academic_year: academic_year, school: school, likert_score: 3)
|
||||
|
||||
admin_data_item = create(:admin_data_item, measure: measure2, description: "Some admin data item description")
|
||||
assign :category, category_presenter
|
||||
|
||||
assign :categories, [category_presenter]
|
||||
assign :school, school
|
||||
assign :district, create(:district)
|
||||
assign :academic_year, academic_year
|
||||
|
||||
render
|
||||
end
|
||||
|
||||
xit "renders attributes in <p>" do
|
||||
render
|
||||
expect(rendered).to match(/Category/)
|
||||
expect(rendered).to match(/MyText/)
|
||||
expect(rendered).to match(/Teachers And The Teaching Environment/)
|
||||
it 'renders the category name and description' do
|
||||
expect(rendered).to match /Some Category/
|
||||
expect(rendered).to match /Some description of the category/
|
||||
end
|
||||
|
||||
context 'for each subcategory' do
|
||||
it 'renders the subcategory name' do
|
||||
expect(rendered).to match /A subcategory/
|
||||
expect(rendered).to match /Another subcategory/
|
||||
end
|
||||
|
||||
it 'renders the subcategory description' do
|
||||
expect(rendered).to match /Some description of the subcategory/
|
||||
expect(rendered).to match /Another description of the subcategory/
|
||||
end
|
||||
|
||||
it 'renders the zone title and fill color for the gauge graph' do
|
||||
expect(rendered).to match /Growth/
|
||||
expect(rendered).to match /fill-growth/
|
||||
end
|
||||
end
|
||||
|
||||
context 'for each measure' do
|
||||
it 'renders the measure name' do
|
||||
expect(rendered).to match /The second measure name/
|
||||
end
|
||||
|
||||
it 'renders the measure description' do
|
||||
expect(rendered).to match /The second measure description/
|
||||
end
|
||||
|
||||
it 'renders a gauge graph and the zone title color' do
|
||||
expect(rendered).to match /Ideal/
|
||||
expect(rendered).to match /fill-ideal/
|
||||
end
|
||||
|
||||
it 'renders the prompts for survey items and admin data that make up the measure' do
|
||||
expect(rendered).to match /Some prompt for student data/
|
||||
expect(rendered).to match /Some prompt for teacher data/
|
||||
expect(rendered).to match /Some admin data item description/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "districts/edit", type: :view do
|
||||
before(:each) do
|
||||
@district = assign(:district, District.create!(
|
||||
:name => "MyString",
|
||||
:state_id => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit district form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", district_path(@district), "post" do
|
||||
|
||||
assert_select "input#district_name[name=?]", "district[name]"
|
||||
|
||||
assert_select "input#district_state_id[name=?]", "district[state_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "districts/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:district, District.new(
|
||||
:name => "MyString",
|
||||
:state_id => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new district form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", districts_path, "post" do
|
||||
|
||||
assert_select "input#district_name[name=?]", "district[name]"
|
||||
|
||||
assert_select "input#district_state_id[name=?]", "district[state_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "districts/show", type: :view do
|
||||
before(:each) do
|
||||
@district = assign(:district, District.create!(
|
||||
:name => "Milford",
|
||||
:state_id => 2
|
||||
))
|
||||
|
||||
schools = []
|
||||
3.times { |i| schools << @district.schools.create!(name: "School #{i}")}
|
||||
@schools = assign(:schools, schools)
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render(template: "districts/show")
|
||||
expect(rendered).to match(/Milford/)
|
||||
expect(rendered).to match(/2/)
|
||||
3.times do |i|
|
||||
expect(rendered).to match(/School #{i}/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -5,7 +5,7 @@ describe 'home/index.html.erb' do
|
|||
|
||||
before :each do
|
||||
assign :districts, [create(:district), create(:district)]
|
||||
assign :categories, [CategoryPresenter.new(category: create(:sqm_category))]
|
||||
assign :categories, [CategoryPresenter.new(category: create(:category))]
|
||||
render
|
||||
end
|
||||
|
||||
|
|
|
|||
32
spec/views/legacy/categories/edit.html.erb_spec.rb
Normal file
32
spec/views/legacy/categories/edit.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/categories/edit", type: :view do
|
||||
before(:each) do
|
||||
@category = assign(:category, Category.create!(
|
||||
:name => "MyString",
|
||||
:blurb => "MyString",
|
||||
:description => "MyText",
|
||||
:external_id => "MyString",
|
||||
:parent_category_id => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit category form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", legacy_category_path(@category), "post" do
|
||||
|
||||
assert_select "input#category_name[name=?]", "category[name]"
|
||||
|
||||
assert_select "input#category_blurb[name=?]", "category[blurb]"
|
||||
|
||||
assert_select "textarea#category_description[name=?]", "category[description]"
|
||||
|
||||
assert_select "input#category_external_id[name=?]", "category[external_id]"
|
||||
|
||||
assert_select "input#category_parent_category_id[name=?]", "category[parent_category_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
33
spec/views/legacy/categories/index.html.erb_spec.rb
Normal file
33
spec/views/legacy/categories/index.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/categories/index", type: :view do
|
||||
before(:each) do
|
||||
assign(:categories, [
|
||||
Category.create!(
|
||||
:name => "Name",
|
||||
:blurb => "Blurb",
|
||||
:description => "MyText",
|
||||
:external_id => "External",
|
||||
:parent_category_id => 2
|
||||
),
|
||||
Category.create!(
|
||||
:name => "Name",
|
||||
:blurb => "Blurb",
|
||||
:description => "MyText",
|
||||
:external_id => "External",
|
||||
:parent_category_id => 2
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of categories" do
|
||||
render(template: "legacy/categories/index")
|
||||
assert_select "tr>td", :text => "Name".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Blurb".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "MyText".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "External".to_s, :count => 2
|
||||
assert_select "tr>td", :text => 2.to_s, :count => 2
|
||||
end
|
||||
end
|
||||
end
|
||||
32
spec/views/legacy/categories/new.html.erb_spec.rb
Normal file
32
spec/views/legacy/categories/new.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/categories/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:category, Category.new(
|
||||
:name => "MyString",
|
||||
:blurb => "MyString",
|
||||
:description => "MyText",
|
||||
:external_id => "MyString",
|
||||
:parent_category_id => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new category form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", legacy_categories_path, "post" do
|
||||
|
||||
assert_select "input#category_name[name=?]", "category[name]"
|
||||
|
||||
assert_select "input#category_blurb[name=?]", "category[blurb]"
|
||||
|
||||
assert_select "textarea#category_description[name=?]", "category[description]"
|
||||
|
||||
assert_select "input#category_external_id[name=?]", "category[external_id]"
|
||||
|
||||
assert_select "input#category_parent_category_id[name=?]", "category[parent_category_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
20
spec/views/legacy/categories/show.html.erb_spec.rb
Normal file
20
spec/views/legacy/categories/show.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "categories/show", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create(name: 'School'))
|
||||
@category = assign(:category, Category.create!(
|
||||
:name => "Category",
|
||||
:description => "MyText",
|
||||
:parent_category => Category.create(name: 'Teachers And The Teaching Environment')
|
||||
))
|
||||
@school_category = assign(:school_category, SchoolCategory.create(school: @school, category: @category))
|
||||
end
|
||||
|
||||
xit "renders attributes in <p>" do
|
||||
render
|
||||
expect(rendered).to match(/Category/)
|
||||
expect(rendered).to match(/MyText/)
|
||||
expect(rendered).to match(/Teachers And The Teaching Environment/)
|
||||
end
|
||||
end
|
||||
23
spec/views/legacy/districts/edit.html.erb_spec.rb
Normal file
23
spec/views/legacy/districts/edit.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/districts/edit", type: :view do
|
||||
before(:each) do
|
||||
@district = assign(:district, Legacy::District.create!(
|
||||
:name => "MyString",
|
||||
:state_id => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit district form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", district_path(@district), "post" do
|
||||
|
||||
assert_select "input#district_name[name=?]", "district[name]"
|
||||
|
||||
assert_select "input#district_state_id[name=?]", "district[state_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
23
spec/views/legacy/districts/new.html.erb_spec.rb
Normal file
23
spec/views/legacy/districts/new.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/districts/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:district, Legacy::District.new(
|
||||
:name => "MyString",
|
||||
:state_id => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new district form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", legacy_districts_path, "post" do
|
||||
|
||||
assert_select "input#district_name[name=?]", "district[name]"
|
||||
|
||||
assert_select "input#district_state_id[name=?]", "district[state_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
25
spec/views/legacy/districts/show.html.erb_spec.rb
Normal file
25
spec/views/legacy/districts/show.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/districts/show", type: :view do
|
||||
before(:each) do
|
||||
@district = assign(:district, Legacy::District.create!(
|
||||
:name => "Milford",
|
||||
:state_id => 2
|
||||
))
|
||||
|
||||
schools = []
|
||||
3.times { |i| schools << @district.schools.create!(name: "School #{i}") }
|
||||
@schools = assign(:schools, schools)
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render(template: "legacy/districts/show")
|
||||
expect(rendered).to match(/Milford/)
|
||||
expect(rendered).to match(/2/)
|
||||
3.times do |i|
|
||||
expect(rendered).to match(/School #{i}/)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
26
spec/views/legacy/question_lists/edit.html.erb_spec.rb
Normal file
26
spec/views/legacy/question_lists/edit.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/question_lists/edit", type: :view do
|
||||
before(:each) do
|
||||
@question_list = assign(:question_list, QuestionList.create!(
|
||||
:name => "MyString",
|
||||
:description => "MyText",
|
||||
:question_ids => "MyText"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit question_list form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", legacy_question_list_path(@question_list), "post" do
|
||||
|
||||
assert_select "input#question_list_name[name=?]", "question_list[name]"
|
||||
|
||||
assert_select "textarea#question_list_description[name=?]", "question_list[description]"
|
||||
|
||||
assert_select "input[name=?]", "question_list[question_id_array][]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
28
spec/views/legacy/question_lists/index.html.erb_spec.rb
Normal file
28
spec/views/legacy/question_lists/index.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/question_lists/index", type: :view do
|
||||
before(:each) do
|
||||
assign(:question_lists, [
|
||||
QuestionList.create!(
|
||||
:name => "Name",
|
||||
:description => "MyText",
|
||||
:question_ids => "1,2,3"
|
||||
),
|
||||
QuestionList.create!(
|
||||
:name => "Name",
|
||||
:description => "MyText",
|
||||
:question_ids => "2,3,4"
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of question_lists" do
|
||||
render(template: "legacy/question_lists/index")
|
||||
assert_select "tr>td", :text => "Name".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "MyText".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "1,2,3".to_s, :count => 1
|
||||
assert_select "tr>td", :text => "2,3,4".to_s, :count => 1
|
||||
end
|
||||
end
|
||||
end
|
||||
26
spec/views/legacy/question_lists/new.html.erb_spec.rb
Normal file
26
spec/views/legacy/question_lists/new.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/question_lists/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:question_list, QuestionList.new(
|
||||
:name => "MyString",
|
||||
:description => "MyText",
|
||||
:question_ids => "MyText"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new question_list form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", legacy_question_lists_path, "post" do
|
||||
|
||||
assert_select "input#question_list_name[name=?]", "question_list[name]"
|
||||
|
||||
assert_select "textarea#question_list_description[name=?]", "question_list[description]"
|
||||
|
||||
assert_select "input[name=?]", "question_list[question_id_array][]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
20
spec/views/legacy/question_lists/show.html.erb_spec.rb
Normal file
20
spec/views/legacy/question_lists/show.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/question_lists/show", type: :view do
|
||||
before(:each) do
|
||||
@question_list = assign(:question_list, QuestionList.create!(
|
||||
:name => "Name",
|
||||
:description => "MyText",
|
||||
:question_ids => "MyText"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render(template: "legacy/question_lists/show")
|
||||
expect(rendered).to match(/Name/)
|
||||
expect(rendered).to match(/MyText/)
|
||||
expect(rendered).to match(/MyText/)
|
||||
end
|
||||
end
|
||||
end
|
||||
38
spec/views/legacy/questions/edit.html.erb_spec.rb
Normal file
38
spec/views/legacy/questions/edit.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/questions/edit", type: :view do
|
||||
before(:each) do
|
||||
@question = assign(:question, Question.create!(
|
||||
:text => "MyString",
|
||||
:option1 => "MyString",
|
||||
:option2 => "MyString",
|
||||
:option3 => "MyString",
|
||||
:option4 => "MyString",
|
||||
:option5 => "MyString",
|
||||
:category_id => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit question form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", legacy_question_path(@question), "post" do
|
||||
|
||||
assert_select "input#question_text[name=?]", "question[text]"
|
||||
|
||||
assert_select "input#question_option1[name=?]", "question[option1]"
|
||||
|
||||
assert_select "input#question_option2[name=?]", "question[option2]"
|
||||
|
||||
assert_select "input#question_option3[name=?]", "question[option3]"
|
||||
|
||||
assert_select "input#question_option4[name=?]", "question[option4]"
|
||||
|
||||
assert_select "input#question_option5[name=?]", "question[option5]"
|
||||
|
||||
assert_select "input#question_category_id[name=?]", "question[category_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
40
spec/views/legacy/questions/index.html.erb_spec.rb
Normal file
40
spec/views/legacy/questions/index.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/questions/index", type: :view do
|
||||
before(:each) do
|
||||
assign(:questions, [
|
||||
Question.create!(
|
||||
:text => "Text",
|
||||
:option1 => "Option1",
|
||||
:option2 => "Option2",
|
||||
:option3 => "Option3",
|
||||
:option4 => "Option4",
|
||||
:option5 => "Option5",
|
||||
:category => Category.create(name: "Category 1")
|
||||
),
|
||||
Question.create!(
|
||||
:text => "Text",
|
||||
:option1 => "Option1",
|
||||
:option2 => "Option2",
|
||||
:option3 => "Option3",
|
||||
:option4 => "Option4",
|
||||
:option5 => "Option5",
|
||||
:category => Category.create(name: "Category 2")
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of questions" do
|
||||
render(template: "legacy/questions/index")
|
||||
assert_select "tr>td", :text => "Text".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Option1".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Option2".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Option3".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Option4".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Option5".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Category 1", :count => 1
|
||||
assert_select "tr>td", :text => "Category 2", :count => 1
|
||||
end
|
||||
end
|
||||
end
|
||||
38
spec/views/legacy/questions/new.html.erb_spec.rb
Normal file
38
spec/views/legacy/questions/new.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/questions/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:question, Question.new(
|
||||
:text => "MyString",
|
||||
:option1 => "MyString",
|
||||
:option2 => "MyString",
|
||||
:option3 => "MyString",
|
||||
:option4 => "MyString",
|
||||
:option5 => "MyString",
|
||||
:category_id => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new question form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", legacy_questions_path, "post" do
|
||||
|
||||
assert_select "input#question_text[name=?]", "question[text]"
|
||||
|
||||
assert_select "input#question_option1[name=?]", "question[option1]"
|
||||
|
||||
assert_select "input#question_option2[name=?]", "question[option2]"
|
||||
|
||||
assert_select "input#question_option3[name=?]", "question[option3]"
|
||||
|
||||
assert_select "input#question_option4[name=?]", "question[option4]"
|
||||
|
||||
assert_select "input#question_option5[name=?]", "question[option5]"
|
||||
|
||||
assert_select "input#question_category_id[name=?]", "question[category_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
30
spec/views/legacy/questions/show.html.erb_spec.rb
Normal file
30
spec/views/legacy/questions/show.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/questions/show", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(name: 'School'))
|
||||
@question = assign(:question, Question.create!(
|
||||
:text => "Question Text",
|
||||
:option1 => "Option1",
|
||||
:option2 => "Option2",
|
||||
:option3 => "Option3",
|
||||
:option4 => "Option4",
|
||||
:option5 => "Option5",
|
||||
:category => Category.create!(name: 'Category Name')
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render(template: "legacy/questions/show")
|
||||
expect(rendered).to match(/School/)
|
||||
expect(rendered).to match(/Question Text/)
|
||||
expect(rendered).to match(/Option1/)
|
||||
expect(rendered).to match(/Option2/)
|
||||
expect(rendered).to match(/Option3/)
|
||||
expect(rendered).to match(/Option4/)
|
||||
expect(rendered).to match(/Option5/)
|
||||
expect(rendered).to match(/Category Name/)
|
||||
end
|
||||
end
|
||||
end
|
||||
31
spec/views/legacy/recipient_lists/edit.html.erb_spec.rb
Normal file
31
spec/views/legacy/recipient_lists/edit.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/recipient_lists/edit", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(
|
||||
:name => "School"
|
||||
))
|
||||
|
||||
@recipient_list = assign(:recipient_list, RecipientList.create!(
|
||||
:name => "MyString",
|
||||
:description => "MyText",
|
||||
:recipient_ids => "1,2,3",
|
||||
:school_id => @school.id
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit recipient_list form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", legacy_school_legacy_recipient_list_path(@school, @recipient_list), "post" do
|
||||
|
||||
assert_select "input#recipient_list_name[name=?]", "recipient_list[name]"
|
||||
|
||||
assert_select "textarea#recipient_list_description[name=?]", "recipient_list[description]"
|
||||
|
||||
assert_select "input[name=?]", "recipient_list[recipient_id_array][]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
32
spec/views/legacy/recipient_lists/index.html.erb_spec.rb
Normal file
32
spec/views/legacy/recipient_lists/index.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/recipient_lists/index", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(name: 'School'))
|
||||
|
||||
assign(:recipient_lists, [
|
||||
RecipientList.create!(
|
||||
:name => "Name",
|
||||
:description => "MyText",
|
||||
:recipient_ids => "1,2,3",
|
||||
:school_id => @school.id
|
||||
),
|
||||
RecipientList.create!(
|
||||
:name => "Name",
|
||||
:description => "MyText",
|
||||
:recipient_ids => "2,3,4",
|
||||
:school_id => @school.id
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of recipient_lists" do
|
||||
render
|
||||
assert_select "tr>td", :text => "Name".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "MyText".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "1,2,3".to_s, :count => 1
|
||||
assert_select "tr>td", :text => "2,3,4".to_s, :count => 1
|
||||
end
|
||||
end
|
||||
end
|
||||
28
spec/views/legacy/recipient_lists/new.html.erb_spec.rb
Normal file
28
spec/views/legacy/recipient_lists/new.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/recipient_lists/new", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(name: 'School'))
|
||||
|
||||
@recipient_list = assign(:recipient_list, RecipientList.new(
|
||||
:name => "MyString",
|
||||
:description => "MyText",
|
||||
:recipient_ids => "MyText",
|
||||
:school_id => @school.id
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new recipient_list form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", legacy_school_legacy_recipient_lists_path(@school, @recipient_list), "post" do
|
||||
assert_select "input#recipient_list_name[name=?]", "recipient_list[name]"
|
||||
|
||||
assert_select "textarea#recipient_list_description[name=?]", "recipient_list[description]"
|
||||
|
||||
assert_select "input[name=?]", "recipient_list[recipient_id_array][]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
28
spec/views/legacy/recipient_lists/show.html.erb_spec.rb
Normal file
28
spec/views/legacy/recipient_lists/show.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/recipient_lists/show", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(name: 'School'))
|
||||
|
||||
recipients = ['Jared Cosulich', 'Lauren Cosulich'].collect do |name|
|
||||
@school.recipients.create!(name: name)
|
||||
end
|
||||
|
||||
@recipient_list = assign(:recipient_list, RecipientList.create!(
|
||||
:name => "Name",
|
||||
:description => "MyText",
|
||||
:recipient_id_array => recipients.map(&:id),
|
||||
:school_id => @school.id
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
expect(rendered).to match(/Name/)
|
||||
expect(rendered).to match(/MyText/)
|
||||
expect(rendered).to match(/Jared Cosulich/)
|
||||
expect(rendered).to match(/Lauren Cosulich/)
|
||||
end
|
||||
end
|
||||
end
|
||||
45
spec/views/legacy/recipients/edit.html.erb_spec.rb
Normal file
45
spec/views/legacy/recipients/edit.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/recipients/edit", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:recipient, School.create!(# TODO does this need to be :school?
|
||||
:name => "School"
|
||||
))
|
||||
|
||||
@recipient = assign(:recipient, Recipient.create!(
|
||||
:name => "MyString",
|
||||
:phone => "MyString",
|
||||
:gender => "MyString",
|
||||
:race => "MyString",
|
||||
:ethnicity => "MyString",
|
||||
:home_language_id => 1,
|
||||
:income => "MyString",
|
||||
:opted_out => false,
|
||||
:school_id => @school.id
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit recipient form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", legacy_school_legacy_recipient_path(@school, @recipient), "post" do
|
||||
|
||||
assert_select "input#recipient_name[name=?]", "recipient[name]"
|
||||
|
||||
assert_select "input#recipient_phone[name=?]", "recipient[phone]"
|
||||
|
||||
assert_select "input#recipient_gender[name=?]", "recipient[gender]"
|
||||
|
||||
assert_select "input#recipient_race[name=?]", "recipient[race]"
|
||||
|
||||
assert_select "input#recipient_ethnicity[name=?]", "recipient[ethnicity]"
|
||||
|
||||
assert_select "input#recipient_home_language_id[name=?]", "recipient[home_language_id]"
|
||||
|
||||
assert_select "input#recipient_income[name=?]", "recipient[income]"
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "recipients/index", type: :view do
|
||||
RSpec.describe "legacy/recipients/index", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(
|
||||
@school = assign(:school, Legacy::School.create!(
|
||||
name: 'School'
|
||||
))
|
||||
|
||||
assign(:recipients, [
|
||||
Recipient.create!(
|
||||
Legacy::Recipient.create!(
|
||||
:name => "Name",
|
||||
:phone => "Phone",
|
||||
:gender => "Gender",
|
||||
|
|
@ -18,7 +18,7 @@ RSpec.describe "recipients/index", type: :view do
|
|||
:opted_out => false,
|
||||
:school_id => @school.id
|
||||
),
|
||||
Recipient.create!(
|
||||
Legacy::Recipient.create!(
|
||||
:name => "Name",
|
||||
:phone => "Phone",
|
||||
:gender => "Gender",
|
||||
|
|
@ -33,7 +33,7 @@ RSpec.describe "recipients/index", type: :view do
|
|||
end
|
||||
|
||||
it "renders a list of recipients" do
|
||||
render(template: "recipients/index")
|
||||
render(template: "legacy/recipients/index")
|
||||
assert_select "tr>td", :text => "Name".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Phone".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Gender".to_s, :count => 2
|
||||
45
spec/views/legacy/recipients/new.html.erb_spec.rb
Normal file
45
spec/views/legacy/recipients/new.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/recipients/new", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(
|
||||
name: 'School'
|
||||
))
|
||||
|
||||
@recipient = assign(:recipient, Recipient.new(
|
||||
:name => "MyString",
|
||||
:phone => "MyString",
|
||||
:gender => "MyString",
|
||||
:race => "MyString",
|
||||
:ethnicity => "MyString",
|
||||
:home_language_id => 1,
|
||||
:income => "MyString",
|
||||
:opted_out => false,
|
||||
:school_id => @school.to_param
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new recipient form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", legacy_school_legacy_recipients_path(@school, @recipient), "post" do
|
||||
|
||||
assert_select "input#recipient_name[name=?]", "recipient[name]"
|
||||
|
||||
assert_select "input#recipient_phone[name=?]", "recipient[phone]"
|
||||
|
||||
assert_select "input#recipient_gender[name=?]", "recipient[gender]"
|
||||
|
||||
assert_select "input#recipient_race[name=?]", "recipient[race]"
|
||||
|
||||
assert_select "input#recipient_ethnicity[name=?]", "recipient[ethnicity]"
|
||||
|
||||
assert_select "input#recipient_home_language_id[name=?]", "recipient[home_language_id]"
|
||||
|
||||
assert_select "input#recipient_income[name=?]", "recipient[income]"
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "recipients/show", type: :view do
|
||||
RSpec.describe "legacy/recipients/show", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(
|
||||
@school = assign(:school, Legacy::School.create!(
|
||||
name: 'School'
|
||||
))
|
||||
|
||||
@recipient = assign(:recipient, Recipient.create!(
|
||||
@recipient = assign(:recipient, Legacy::Recipient.create!(
|
||||
:name => "Name",
|
||||
:phone => "Phone",
|
||||
:gender => "Gender",
|
||||
45
spec/views/legacy/schedules/edit.html.erb_spec.rb
Normal file
45
spec/views/legacy/schedules/edit.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/schedules/edit", type: :view do
|
||||
before(:each) do
|
||||
question_list = QuestionList.create!(name: 'Parents Questions', question_id_array: [1, 2, 3])
|
||||
|
||||
@school = assign(:school, School.create!(name: 'School'))
|
||||
|
||||
recipient_list = RecipientList.create!(name: 'Parents', recipient_id_array: [1, 2, 3], school: @school)
|
||||
|
||||
@schedule = assign(:schedule, Schedule.create!(
|
||||
:name => "MyString",
|
||||
:description => "MyText",
|
||||
:school_id => @school.id,
|
||||
:frequency_hours => 1,
|
||||
:active => false,
|
||||
:random => false,
|
||||
:recipient_list_id => recipient_list.id,
|
||||
:question_list_id => question_list.id
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit schedule form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", legacy_school_legacy_schedule_path(@school, @schedule), "post" do
|
||||
|
||||
assert_select "input#schedule_name[name=?]", "schedule[name]"
|
||||
|
||||
assert_select "textarea#schedule_description[name=?]", "schedule[description]"
|
||||
|
||||
assert_select "select[name=?]", "schedule[frequency_hours]"
|
||||
|
||||
assert_select "input#schedule_active[name=?]", "schedule[active]"
|
||||
|
||||
assert_select "input#schedule_random[name=?]", "schedule[random]"
|
||||
|
||||
assert_select "select[name=?]", "schedule[recipient_list_id]"
|
||||
|
||||
assert_select "select[name=?]", "schedule[question_list_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
45
spec/views/legacy/schedules/new.html.erb_spec.rb
Normal file
45
spec/views/legacy/schedules/new.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/schedules/new", type: :view do
|
||||
before(:each) do
|
||||
question_list = QuestionList.create!(name: 'Parents Questions', question_id_array: [1, 2, 3])
|
||||
|
||||
@school = assign(:school, School.create!(name: 'School'))
|
||||
|
||||
recipient_list = RecipientList.create!(name: 'Parents', recipient_id_array: [1, 2, 3], school: @school)
|
||||
|
||||
assign(:schedule, Schedule.new(
|
||||
:name => "MyString",
|
||||
:description => "MyText",
|
||||
:school => @school,
|
||||
:frequency_hours => 1,
|
||||
:active => false,
|
||||
:random => false,
|
||||
:recipient_list => @recipient_list,
|
||||
:question_list => @question_list
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new schedule form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", legacy_school_legacy_schedules_path(@school), "post" do
|
||||
|
||||
assert_select "input#schedule_name[name=?]", "schedule[name]"
|
||||
|
||||
assert_select "textarea#schedule_description[name=?]", "schedule[description]"
|
||||
|
||||
assert_select "select[name=?]", "schedule[frequency_hours]"
|
||||
|
||||
assert_select "input#schedule_active[name=?]", "schedule[active]"
|
||||
|
||||
assert_select "input#schedule_random[name=?]", "schedule[random]"
|
||||
|
||||
assert_select "select[name=?]", "schedule[recipient_list_id]"
|
||||
|
||||
assert_select "select[name=?]", "schedule[question_list_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
36
spec/views/legacy/schedules/show.html.erb_spec.rb
Normal file
36
spec/views/legacy/schedules/show.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/schedules/show", type: :view do
|
||||
before(:each) do
|
||||
@question_list = QuestionList.create!(name: 'Parents Questions', question_id_array: [1, 2, 3])
|
||||
|
||||
@school = assign(:school, School.create!(name: 'School'))
|
||||
|
||||
@recipient_list = RecipientList.create!(name: 'Parents', recipient_id_array: [1, 2, 3], school: @school)
|
||||
|
||||
@schedule = assign(:schedule, Schedule.create!(
|
||||
:name => "Name",
|
||||
:description => "MyText",
|
||||
:school => @school,
|
||||
:frequency_hours => 2 * 24 * 7,
|
||||
:active => false,
|
||||
:random => false,
|
||||
:recipient_list => @recipient_list,
|
||||
:question_list => @question_list
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
expect(rendered).to match(/Name/)
|
||||
expect(rendered).to match(/MyText/)
|
||||
expect(rendered).to match(/#{@school.name}/)
|
||||
expect(rendered).to match(/Every Other Week/)
|
||||
expect(rendered).to match(/false/)
|
||||
expect(rendered).to match(/false/)
|
||||
expect(rendered).to match(/#{@recipient_list.name}/)
|
||||
expect(rendered).to match(/#{@question_list.name}/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "schools/edit", type: :view do
|
||||
RSpec.describe "legacy/schools/edit", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(
|
||||
@school = assign(:school, Legacy::School.create!(
|
||||
:name => "MyString",
|
||||
:district_id => 1
|
||||
))
|
||||
|
|
@ -11,7 +11,7 @@ RSpec.describe "schools/edit", type: :view do
|
|||
it "renders the edit school form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", school_path(@school), "post" do
|
||||
assert_select "form[action=?][method=?]", legacy_school_path(@school), "post" do
|
||||
|
||||
assert_select "input#school_name[name=?]", "school[name]"
|
||||
|
||||
22
spec/views/legacy/schools/new.html.erb_spec.rb
Normal file
22
spec/views/legacy/schools/new.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/schools/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:school, School.new(
|
||||
:name => "MyString",
|
||||
:district_id => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new school form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", legacy_schools_path, "post" do
|
||||
|
||||
assert_select "input#school_name[name=?]", "school[name]"
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
19
spec/views/legacy/schools/show.html.erb_spec.rb
Normal file
19
spec/views/legacy/schools/show.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
require 'rails_helper'
|
||||
|
||||
module Legacy
|
||||
RSpec.describe "legacy/schools/show", type: :view do
|
||||
before(:each) do
|
||||
@school_categories = []
|
||||
@school = assign(:school, School.create!(
|
||||
:name => "School",
|
||||
:district => District.create(name: 'District')
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render(template: "legacy/schools/show")
|
||||
expect(rendered).to match(/School/)
|
||||
expect(rendered).to match(/District/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "question_lists/edit", type: :view do
|
||||
before(:each) do
|
||||
@question_list = assign(:question_list, QuestionList.create!(
|
||||
:name => "MyString",
|
||||
:description => "MyText",
|
||||
:question_ids => "MyText"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit question_list form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", question_list_path(@question_list), "post" do
|
||||
|
||||
assert_select "input#question_list_name[name=?]", "question_list[name]"
|
||||
|
||||
assert_select "textarea#question_list_description[name=?]", "question_list[description]"
|
||||
|
||||
assert_select "input[name=?]", "question_list[question_id_array][]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "question_lists/index", type: :view do
|
||||
before(:each) do
|
||||
assign(:question_lists, [
|
||||
QuestionList.create!(
|
||||
:name => "Name",
|
||||
:description => "MyText",
|
||||
:question_ids => "1,2,3"
|
||||
),
|
||||
QuestionList.create!(
|
||||
:name => "Name",
|
||||
:description => "MyText",
|
||||
:question_ids => "2,3,4"
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of question_lists" do
|
||||
render(template: "question_lists/index" )
|
||||
assert_select "tr>td", :text => "Name".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "MyText".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "1,2,3".to_s, :count => 1
|
||||
assert_select "tr>td", :text => "2,3,4".to_s, :count => 1
|
||||
end
|
||||
end
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "question_lists/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:question_list, QuestionList.new(
|
||||
:name => "MyString",
|
||||
:description => "MyText",
|
||||
:question_ids => "MyText"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new question_list form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", question_lists_path, "post" do
|
||||
|
||||
assert_select "input#question_list_name[name=?]", "question_list[name]"
|
||||
|
||||
assert_select "textarea#question_list_description[name=?]", "question_list[description]"
|
||||
|
||||
assert_select "input[name=?]", "question_list[question_id_array][]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "question_lists/show", type: :view do
|
||||
before(:each) do
|
||||
@question_list = assign(:question_list, QuestionList.create!(
|
||||
:name => "Name",
|
||||
:description => "MyText",
|
||||
:question_ids => "MyText"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render(template: "question_lists/show")
|
||||
expect(rendered).to match(/Name/)
|
||||
expect(rendered).to match(/MyText/)
|
||||
expect(rendered).to match(/MyText/)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "questions/edit", type: :view do
|
||||
before(:each) do
|
||||
@question = assign(:question, Question.create!(
|
||||
:text => "MyString",
|
||||
:option1 => "MyString",
|
||||
:option2 => "MyString",
|
||||
:option3 => "MyString",
|
||||
:option4 => "MyString",
|
||||
:option5 => "MyString",
|
||||
:category_id => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit question form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", question_path(@question), "post" do
|
||||
|
||||
assert_select "input#question_text[name=?]", "question[text]"
|
||||
|
||||
assert_select "input#question_option1[name=?]", "question[option1]"
|
||||
|
||||
assert_select "input#question_option2[name=?]", "question[option2]"
|
||||
|
||||
assert_select "input#question_option3[name=?]", "question[option3]"
|
||||
|
||||
assert_select "input#question_option4[name=?]", "question[option4]"
|
||||
|
||||
assert_select "input#question_option5[name=?]", "question[option5]"
|
||||
|
||||
assert_select "input#question_category_id[name=?]", "question[category_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "questions/index", type: :view do
|
||||
before(:each) do
|
||||
assign(:questions, [
|
||||
Question.create!(
|
||||
:text => "Text",
|
||||
:option1 => "Option1",
|
||||
:option2 => "Option2",
|
||||
:option3 => "Option3",
|
||||
:option4 => "Option4",
|
||||
:option5 => "Option5",
|
||||
:category => Category.create(name: "Category 1")
|
||||
),
|
||||
Question.create!(
|
||||
:text => "Text",
|
||||
:option1 => "Option1",
|
||||
:option2 => "Option2",
|
||||
:option3 => "Option3",
|
||||
:option4 => "Option4",
|
||||
:option5 => "Option5",
|
||||
:category => Category.create(name: "Category 2")
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of questions" do
|
||||
render(template: "questions/index")
|
||||
assert_select "tr>td", :text => "Text".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Option1".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Option2".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Option3".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Option4".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Option5".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Category 1", :count => 1
|
||||
assert_select "tr>td", :text => "Category 2", :count => 1
|
||||
end
|
||||
end
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "questions/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:question, Question.new(
|
||||
:text => "MyString",
|
||||
:option1 => "MyString",
|
||||
:option2 => "MyString",
|
||||
:option3 => "MyString",
|
||||
:option4 => "MyString",
|
||||
:option5 => "MyString",
|
||||
:category_id => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new question form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", questions_path, "post" do
|
||||
|
||||
assert_select "input#question_text[name=?]", "question[text]"
|
||||
|
||||
assert_select "input#question_option1[name=?]", "question[option1]"
|
||||
|
||||
assert_select "input#question_option2[name=?]", "question[option2]"
|
||||
|
||||
assert_select "input#question_option3[name=?]", "question[option3]"
|
||||
|
||||
assert_select "input#question_option4[name=?]", "question[option4]"
|
||||
|
||||
assert_select "input#question_option5[name=?]", "question[option5]"
|
||||
|
||||
assert_select "input#question_category_id[name=?]", "question[category_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "questions/show", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(name: 'School'))
|
||||
@question = assign(:question, Question.create!(
|
||||
:text => "Question Text",
|
||||
:option1 => "Option1",
|
||||
:option2 => "Option2",
|
||||
:option3 => "Option3",
|
||||
:option4 => "Option4",
|
||||
:option5 => "Option5",
|
||||
:category => Category.create!(name: 'Category Name')
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render(template: "questions/show")
|
||||
expect(rendered).to match(/School/)
|
||||
expect(rendered).to match(/Question Text/)
|
||||
expect(rendered).to match(/Option1/)
|
||||
expect(rendered).to match(/Option2/)
|
||||
expect(rendered).to match(/Option3/)
|
||||
expect(rendered).to match(/Option4/)
|
||||
expect(rendered).to match(/Option5/)
|
||||
expect(rendered).to match(/Category Name/)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "recipient_lists/edit", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(
|
||||
:name => "School"
|
||||
))
|
||||
|
||||
@recipient_list = assign(:recipient_list, RecipientList.create!(
|
||||
:name => "MyString",
|
||||
:description => "MyText",
|
||||
:recipient_ids => "1,2,3",
|
||||
:school_id => @school.id
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit recipient_list form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", school_recipient_list_path(@school, @recipient_list), "post" do
|
||||
|
||||
assert_select "input#recipient_list_name[name=?]", "recipient_list[name]"
|
||||
|
||||
assert_select "textarea#recipient_list_description[name=?]", "recipient_list[description]"
|
||||
|
||||
assert_select "input[name=?]", "recipient_list[recipient_id_array][]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "recipient_lists/index", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(name: 'School'))
|
||||
|
||||
assign(:recipient_lists, [
|
||||
RecipientList.create!(
|
||||
:name => "Name",
|
||||
:description => "MyText",
|
||||
:recipient_ids => "1,2,3",
|
||||
:school_id => @school.id
|
||||
),
|
||||
RecipientList.create!(
|
||||
:name => "Name",
|
||||
:description => "MyText",
|
||||
:recipient_ids => "2,3,4",
|
||||
:school_id => @school.id
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of recipient_lists" do
|
||||
render
|
||||
assert_select "tr>td", :text => "Name".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "MyText".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "1,2,3".to_s, :count => 1
|
||||
assert_select "tr>td", :text => "2,3,4".to_s, :count => 1
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "recipient_lists/new", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(name: 'School'))
|
||||
|
||||
@recipient_list = assign(:recipient_list, RecipientList.new(
|
||||
:name => "MyString",
|
||||
:description => "MyText",
|
||||
:recipient_ids => "MyText",
|
||||
:school_id => @school.id
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new recipient_list form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", school_recipient_lists_path(@school, @recipient_list), "post" do
|
||||
assert_select "input#recipient_list_name[name=?]", "recipient_list[name]"
|
||||
|
||||
assert_select "textarea#recipient_list_description[name=?]", "recipient_list[description]"
|
||||
|
||||
assert_select "input[name=?]", "recipient_list[recipient_id_array][]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "recipient_lists/show", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(name: 'School'))
|
||||
|
||||
recipients = ['Jared Cosulich', 'Lauren Cosulich'].collect do |name|
|
||||
@school.recipients.create!(name: name)
|
||||
end
|
||||
|
||||
@recipient_list = assign(:recipient_list, RecipientList.create!(
|
||||
:name => "Name",
|
||||
:description => "MyText",
|
||||
:recipient_id_array => recipients.map(&:id),
|
||||
:school_id => @school.id
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
expect(rendered).to match(/Name/)
|
||||
expect(rendered).to match(/MyText/)
|
||||
expect(rendered).to match(/Jared Cosulich/)
|
||||
expect(rendered).to match(/Lauren Cosulich/)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "recipients/edit", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:recipient, School.create!(
|
||||
:name => "School"
|
||||
))
|
||||
|
||||
@recipient = assign(:recipient, Recipient.create!(
|
||||
:name => "MyString",
|
||||
:phone => "MyString",
|
||||
:gender => "MyString",
|
||||
:race => "MyString",
|
||||
:ethnicity => "MyString",
|
||||
:home_language_id => 1,
|
||||
:income => "MyString",
|
||||
:opted_out => false,
|
||||
:school_id => @school.id
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit recipient form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", school_recipient_path(@school, @recipient), "post" do
|
||||
|
||||
assert_select "input#recipient_name[name=?]", "recipient[name]"
|
||||
|
||||
assert_select "input#recipient_phone[name=?]", "recipient[phone]"
|
||||
|
||||
assert_select "input#recipient_gender[name=?]", "recipient[gender]"
|
||||
|
||||
assert_select "input#recipient_race[name=?]", "recipient[race]"
|
||||
|
||||
assert_select "input#recipient_ethnicity[name=?]", "recipient[ethnicity]"
|
||||
|
||||
assert_select "input#recipient_home_language_id[name=?]", "recipient[home_language_id]"
|
||||
|
||||
assert_select "input#recipient_income[name=?]", "recipient[income]"
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "recipients/new", type: :view do
|
||||
before(:each) do
|
||||
@school = assign(:school, School.create!(
|
||||
name: 'School'
|
||||
))
|
||||
|
||||
@recipient = assign(:recipient, Recipient.new(
|
||||
:name => "MyString",
|
||||
:phone => "MyString",
|
||||
:gender => "MyString",
|
||||
:race => "MyString",
|
||||
:ethnicity => "MyString",
|
||||
:home_language_id => 1,
|
||||
:income => "MyString",
|
||||
:opted_out => false,
|
||||
:school_id => @school.to_param
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new recipient form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", school_recipients_path(@school, @recipient), "post" do
|
||||
|
||||
assert_select "input#recipient_name[name=?]", "recipient[name]"
|
||||
|
||||
assert_select "input#recipient_phone[name=?]", "recipient[phone]"
|
||||
|
||||
assert_select "input#recipient_gender[name=?]", "recipient[gender]"
|
||||
|
||||
assert_select "input#recipient_race[name=?]", "recipient[race]"
|
||||
|
||||
assert_select "input#recipient_ethnicity[name=?]", "recipient[ethnicity]"
|
||||
|
||||
assert_select "input#recipient_home_language_id[name=?]", "recipient[home_language_id]"
|
||||
|
||||
assert_select "input#recipient_income[name=?]", "recipient[income]"
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "schedules/edit", type: :view do
|
||||
before(:each) do
|
||||
question_list = QuestionList.create!(name: 'Parents Questions', question_id_array: [1, 2, 3])
|
||||
|
||||
@school = assign(:school, School.create!(name: 'School'))
|
||||
|
||||
recipient_list = RecipientList.create!(name: 'Parents', recipient_id_array: [1, 2, 3], school: @school)
|
||||
|
||||
@schedule = assign(:schedule, Schedule.create!(
|
||||
:name => "MyString",
|
||||
:description => "MyText",
|
||||
:school_id => @school.id,
|
||||
:frequency_hours => 1,
|
||||
:active => false,
|
||||
:random => false,
|
||||
:recipient_list_id => recipient_list.id,
|
||||
:question_list_id => question_list.id
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit schedule form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", school_schedule_path(@school, @schedule), "post" do
|
||||
|
||||
assert_select "input#schedule_name[name=?]", "schedule[name]"
|
||||
|
||||
assert_select "textarea#schedule_description[name=?]", "schedule[description]"
|
||||
|
||||
assert_select "select[name=?]", "schedule[frequency_hours]"
|
||||
|
||||
assert_select "input#schedule_active[name=?]", "schedule[active]"
|
||||
|
||||
assert_select "input#schedule_random[name=?]", "schedule[random]"
|
||||
|
||||
assert_select "select[name=?]", "schedule[recipient_list_id]"
|
||||
|
||||
assert_select "select[name=?]", "schedule[question_list_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "schedules/new", type: :view do
|
||||
before(:each) do
|
||||
question_list = QuestionList.create!(name: 'Parents Questions', question_id_array: [1, 2, 3])
|
||||
|
||||
@school = assign(:school, School.create!(name: 'School'))
|
||||
|
||||
recipient_list = RecipientList.create!(name: 'Parents', recipient_id_array: [1, 2, 3], school: @school)
|
||||
|
||||
assign(:schedule, Schedule.new(
|
||||
:name => "MyString",
|
||||
:description => "MyText",
|
||||
:school => @school,
|
||||
:frequency_hours => 1,
|
||||
:active => false,
|
||||
:random => false,
|
||||
:recipient_list => @recipient_list,
|
||||
:question_list => @question_list
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new schedule form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", school_schedules_path(@school), "post" do
|
||||
|
||||
assert_select "input#schedule_name[name=?]", "schedule[name]"
|
||||
|
||||
assert_select "textarea#schedule_description[name=?]", "schedule[description]"
|
||||
|
||||
assert_select "select[name=?]", "schedule[frequency_hours]"
|
||||
|
||||
assert_select "input#schedule_active[name=?]", "schedule[active]"
|
||||
|
||||
assert_select "input#schedule_random[name=?]", "schedule[random]"
|
||||
|
||||
assert_select "select[name=?]", "schedule[recipient_list_id]"
|
||||
|
||||
assert_select "select[name=?]", "schedule[question_list_id]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "schedules/show", type: :view do
|
||||
before(:each) do
|
||||
@question_list = QuestionList.create!(name: 'Parents Questions', question_id_array: [1, 2, 3])
|
||||
|
||||
@school = assign(:school, School.create!(name: 'School'))
|
||||
|
||||
@recipient_list = RecipientList.create!(name: 'Parents', recipient_id_array: [1, 2, 3], school: @school)
|
||||
|
||||
@schedule = assign(:schedule, Schedule.create!(
|
||||
:name => "Name",
|
||||
:description => "MyText",
|
||||
:school => @school,
|
||||
:frequency_hours => 2 * 24 * 7,
|
||||
:active => false,
|
||||
:random => false,
|
||||
:recipient_list => @recipient_list,
|
||||
:question_list => @question_list
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
expect(rendered).to match(/Name/)
|
||||
expect(rendered).to match(/MyText/)
|
||||
expect(rendered).to match(/#{@school.name}/)
|
||||
expect(rendered).to match(/Every Other Week/)
|
||||
expect(rendered).to match(/false/)
|
||||
expect(rendered).to match(/false/)
|
||||
expect(rendered).to match(/#{@recipient_list.name}/)
|
||||
expect(rendered).to match(/#{@question_list.name}/)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "schools/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:school, School.new(
|
||||
:name => "MyString",
|
||||
:district_id => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new school form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", schools_path, "post" do
|
||||
|
||||
assert_select "input#school_name[name=?]", "school[name]"
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "schools/show", type: :view do
|
||||
before(:each) do
|
||||
@school_categories = []
|
||||
@school = assign(:school, School.create!(
|
||||
:name => "School",
|
||||
:district => District.create(name: 'District')
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render(template: "schools/show")
|
||||
expect(rendered).to match(/School/)
|
||||
expect(rendered).to match(/District/)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe 'sqm_categories/show.html.erb' do
|
||||
before :each do
|
||||
academic_year = create(:academic_year, range: '1989-90')
|
||||
school = create(:school, name: 'Best School')
|
||||
|
||||
category = create(:sqm_category, name: 'Some Category', description: 'Some description of the category')
|
||||
category_presenter = CategoryPresenter.new(category: category)
|
||||
|
||||
subcategory1 = create(:subcategory, sqm_category: category, name: 'A subcategory', description: 'Some description of the subcategory')
|
||||
subcategory2 = create(:subcategory_with_measures, sqm_category: category, name: 'Another subcategory', description: 'Another description of the subcategory')
|
||||
|
||||
measure1 = create(:measure, subcategory: subcategory1, watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
|
||||
survey_item1 = create(:student_survey_item, measure: measure1)
|
||||
create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: survey_item1, academic_year: academic_year, school: school, likert_score: 1)
|
||||
|
||||
measure2 = create(:measure, name: 'The second measure name', description: 'The second measure description', subcategory: subcategory1, watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
|
||||
student_survey_item = create(:student_survey_item, measure: measure2, prompt: "Some prompt for student data")
|
||||
create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: student_survey_item, academic_year: academic_year, school: school, likert_score: 5)
|
||||
|
||||
teacher_survey_item = create(:teacher_survey_item, measure: measure2, prompt: "Some prompt for teacher data")
|
||||
create_list(:survey_item_response, SurveyItemResponse::TEACHER_RESPONSE_THRESHOLD, survey_item: teacher_survey_item, academic_year: academic_year, school: school, likert_score: 3)
|
||||
|
||||
admin_data_item = create(:admin_data_item, measure: measure2, description: "Some admin data item description")
|
||||
assign :category, category_presenter
|
||||
|
||||
assign :categories, [category_presenter]
|
||||
assign :school, school
|
||||
assign :district, create(:district)
|
||||
assign :academic_year, academic_year
|
||||
|
||||
render
|
||||
end
|
||||
|
||||
it 'renders the category name and description' do
|
||||
expect(rendered).to match /Some Category/
|
||||
expect(rendered).to match /Some description of the category/
|
||||
end
|
||||
|
||||
context 'for each subcategory' do
|
||||
it 'renders the subcategory name' do
|
||||
expect(rendered).to match /A subcategory/
|
||||
expect(rendered).to match /Another subcategory/
|
||||
end
|
||||
|
||||
it 'renders the subcategory description' do
|
||||
expect(rendered).to match /Some description of the subcategory/
|
||||
expect(rendered).to match /Another description of the subcategory/
|
||||
end
|
||||
|
||||
it 'renders the zone title and fill color for the gauge graph' do
|
||||
expect(rendered).to match /Growth/
|
||||
expect(rendered).to match /fill-growth/
|
||||
end
|
||||
end
|
||||
|
||||
context 'for each measure' do
|
||||
it 'renders the measure name' do
|
||||
expect(rendered).to match /The second measure name/
|
||||
end
|
||||
|
||||
it 'renders the measure description' do
|
||||
expect(rendered).to match /The second measure description/
|
||||
end
|
||||
|
||||
it 'renders a gauge graph and the zone title color' do
|
||||
expect(rendered).to match /Ideal/
|
||||
expect(rendered).to match /fill-ideal/
|
||||
end
|
||||
|
||||
it 'renders the prompts for survey items and admin data that make up the measure' do
|
||||
expect(rendered).to match /Some prompt for student data/
|
||||
expect(rendered).to match /Some prompt for teacher data/
|
||||
expect(rendered).to match /Some admin data item description/
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue