Add tests
This commit is contained in:
parent
363dfaa7d3
commit
cdea0e1218
14 changed files with 116 additions and 52 deletions
|
|
@ -1,45 +1,49 @@
|
|||
require "test_helper"
|
||||
require 'test_helper'
|
||||
|
||||
class ChecklistEntriesControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@checklist_entry = checklist_entries(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
test 'should get index' do
|
||||
get checklist_entries_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get new_checklist_entry_url
|
||||
test 'should get new' do
|
||||
get new_checklist_entry_url(checklist_id: @checklist_entry.checklist_id)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create checklist_entry" do
|
||||
assert_difference("ChecklistEntry.count") do
|
||||
post checklist_entries_url, params: { checklist_entry: { check_id: @checklist_entry.check_id, checklist_id: @checklist_entry.checklist_id, position: @checklist_entry.position } }
|
||||
test 'should create checklist_entry' do
|
||||
assert_difference('ChecklistEntry.count') do
|
||||
post checklist_entries_url,
|
||||
params: { checklist_entry: { check_id: @checklist_entry.check_id, checklist_id: @checklist_entry.checklist_id,
|
||||
position: @checklist_entry.position } }
|
||||
end
|
||||
|
||||
assert_redirected_to checklist_entry_url(ChecklistEntry.last)
|
||||
assert_redirected_to checklist_url(ChecklistEntry.last.checklist)
|
||||
end
|
||||
|
||||
test "should show checklist_entry" do
|
||||
test 'should show checklist_entry' do
|
||||
get checklist_entry_url(@checklist_entry)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
test 'should get edit' do
|
||||
get edit_checklist_entry_url(@checklist_entry)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update checklist_entry" do
|
||||
patch checklist_entry_url(@checklist_entry), params: { checklist_entry: { check_id: @checklist_entry.check_id, checklist_id: @checklist_entry.checklist_id, position: @checklist_entry.position } }
|
||||
assert_redirected_to checklist_entry_url(@checklist_entry)
|
||||
test 'should update checklist_entry' do
|
||||
patch checklist_entry_url(@checklist_entry),
|
||||
params: { checklist_entry: { check_id: @checklist_entry.check_id, checklist_id: @checklist_entry.checklist_id,
|
||||
position: @checklist_entry.position } }
|
||||
assert_redirected_to checklist_url(@checklist_entry.checklist)
|
||||
end
|
||||
|
||||
test "should destroy checklist_entry" do
|
||||
assert_difference("ChecklistEntry.count", -1) do
|
||||
test 'should destroy checklist_entry' do
|
||||
assert_difference('ChecklistEntry.count', -1) do
|
||||
delete checklist_entry_url(@checklist_entry)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,45 +1,49 @@
|
|||
require "test_helper"
|
||||
require 'test_helper'
|
||||
|
||||
class ChecksControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@check = checks(:one)
|
||||
@check = checks(:deletable)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
test 'should get index' do
|
||||
get checks_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
test 'should get new' do
|
||||
get new_check_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create check" do
|
||||
assert_difference("Check.count") do
|
||||
post checks_url, params: { check: { level: @check.level, name: @check.name, position: @check.position, success_criterion: @check.success_criterion } }
|
||||
test 'should create check' do
|
||||
assert_difference('Check.count') do
|
||||
post checks_url,
|
||||
params: { check: { level: @check.level, name: @check.name, position: @check.position,
|
||||
success_criterion: @check.success_criterion } }
|
||||
end
|
||||
|
||||
assert_redirected_to check_url(Check.last)
|
||||
end
|
||||
|
||||
test "should show check" do
|
||||
test 'should show check' do
|
||||
get check_url(@check)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
test 'should get edit' do
|
||||
get edit_check_url(@check)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update check" do
|
||||
patch check_url(@check), params: { check: { level: @check.level, name: @check.name, position: @check.position, success_criterion: @check.success_criterion } }
|
||||
test 'should update check' do
|
||||
patch check_url(@check),
|
||||
params: { check: { level: @check.level, name: @check.name, position: @check.position,
|
||||
success_criterion: @check.success_criterion } }
|
||||
assert_redirected_to check_url(@check)
|
||||
end
|
||||
|
||||
test "should destroy check" do
|
||||
assert_difference("Check.count", -1) do
|
||||
test 'should destroy check' do
|
||||
assert_difference('Check.count', -1) do
|
||||
delete check_url(@check)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,45 +1,50 @@
|
|||
require "test_helper"
|
||||
require 'test_helper'
|
||||
|
||||
class ElementsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@element = elements(:one)
|
||||
@checklist = checklists(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
test 'should get index' do
|
||||
get elements_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
test 'should get new' do
|
||||
get new_element_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create element" do
|
||||
assert_difference("Element.count") do
|
||||
post elements_url, params: { element: { description: @element.description, path: @element.path, report_id: @element.report_id, title: @element.title } }
|
||||
test 'should create element' do
|
||||
assert_difference('Element.count') do
|
||||
post elements_url,
|
||||
params: { element: { description: @element.description, path: @element.path, report_id: @element.report_id,
|
||||
title: @element.title, checklist_id: @checklist.id } }
|
||||
end
|
||||
|
||||
assert_redirected_to element_url(Element.last)
|
||||
assert_redirected_to report_url(Element.last.report)
|
||||
end
|
||||
|
||||
test "should show element" do
|
||||
test 'should show element' do
|
||||
get element_url(@element)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
test 'should get edit' do
|
||||
get edit_element_url(@element)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update element" do
|
||||
patch element_url(@element), params: { element: { description: @element.description, path: @element.path, report_id: @element.report_id, title: @element.title } }
|
||||
test 'should update element' do
|
||||
patch element_url(@element),
|
||||
params: { element: { description: @element.description, path: @element.path, report_id: @element.report_id,
|
||||
title: @element.title } }
|
||||
assert_redirected_to element_url(@element)
|
||||
end
|
||||
|
||||
test "should destroy element" do
|
||||
assert_difference("Element.count", -1) do
|
||||
test 'should destroy element' do
|
||||
assert_difference('Element.count', -1) do
|
||||
delete element_url(@element)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ require 'test_helper'
|
|||
|
||||
class HomeControllerTest < ActionDispatch::IntegrationTest
|
||||
test 'should get show' do
|
||||
get home_show_url
|
||||
get root_url
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue