Add tests
Some checks failed
/ Text (push) Failing after 15s
/ Checkout (push) Successful in 1m3s

This commit is contained in:
david 2024-07-22 22:40:56 +02:00
parent 363dfaa7d3
commit cdea0e1218
14 changed files with 116 additions and 52 deletions

View file

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