mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-11 00:10:35 -07:00
working on question_lists
This commit is contained in:
parent
d731049fc6
commit
cc84c3bbda
26 changed files with 498 additions and 10 deletions
|
|
@ -7,7 +7,7 @@ RSpec.describe "categories/show", type: :view do
|
|||
:blurb => "Blurb",
|
||||
:description => "MyText",
|
||||
:external_id => "External",
|
||||
:parent_category_id => 2
|
||||
:parent_category => Category.create(name: 'Parent Category')
|
||||
))
|
||||
end
|
||||
|
||||
|
|
@ -17,6 +17,6 @@ RSpec.describe "categories/show", type: :view do
|
|||
expect(rendered).to match(/Blurb/)
|
||||
expect(rendered).to match(/MyText/)
|
||||
expect(rendered).to match(/External/)
|
||||
expect(rendered).to match(/2/)
|
||||
expect(rendered).to match(/Parent Category/)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
24
spec/views/question_lists/edit.html.erb_spec.rb
Normal file
24
spec/views/question_lists/edit.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
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 "textarea#question_list_question_ids[name=?]", "question_list[question_ids]"
|
||||
end
|
||||
end
|
||||
end
|
||||
26
spec/views/question_lists/index.html.erb_spec.rb
Normal file
26
spec/views/question_lists/index.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
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
|
||||
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
|
||||
24
spec/views/question_lists/new.html.erb_spec.rb
Normal file
24
spec/views/question_lists/new.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
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 "textarea#question_list_question_ids[name=?]", "question_list[question_ids]"
|
||||
end
|
||||
end
|
||||
end
|
||||
18
spec/views/question_lists/show.html.erb_spec.rb
Normal file
18
spec/views/question_lists/show.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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
|
||||
expect(rendered).to match(/Name/)
|
||||
expect(rendered).to match(/MyText/)
|
||||
expect(rendered).to match(/MyText/)
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@ RSpec.describe "questions/index", type: :view do
|
|||
:option3 => "Option3",
|
||||
:option4 => "Option4",
|
||||
:option5 => "Option5",
|
||||
:category_id => 2
|
||||
:category => Category.create(name: "Category 1")
|
||||
),
|
||||
Question.create!(
|
||||
:text => "Text",
|
||||
|
|
@ -19,7 +19,7 @@ RSpec.describe "questions/index", type: :view do
|
|||
:option3 => "Option3",
|
||||
:option4 => "Option4",
|
||||
:option5 => "Option5",
|
||||
:category_id => 2
|
||||
:category => Category.create(name: "Category 2")
|
||||
)
|
||||
])
|
||||
end
|
||||
|
|
@ -32,6 +32,7 @@ RSpec.describe "questions/index", type: :view do
|
|||
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 => 2.to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Category 1", :count => 1
|
||||
assert_select "tr>td", :text => "Category 2", :count => 1
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ RSpec.describe "questions/show", type: :view do
|
|||
:option3 => "Option3",
|
||||
:option4 => "Option4",
|
||||
:option5 => "Option5",
|
||||
:category_id => 2
|
||||
:category => Category.create!(name: 'Category Name')
|
||||
))
|
||||
end
|
||||
|
||||
|
|
@ -21,6 +21,6 @@ RSpec.describe "questions/show", type: :view do
|
|||
expect(rendered).to match(/Option3/)
|
||||
expect(rendered).to match(/Option4/)
|
||||
expect(rendered).to match(/Option5/)
|
||||
expect(rendered).to match(/2/)
|
||||
expect(rendered).to match(/Category Name/)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue