Basic feature implemented, very basic poc

This commit is contained in:
David Schärer 2024-07-16 20:22:59 +02:00
parent 216089a3e7
commit 48c0067076
118 changed files with 2113 additions and 20 deletions

View file

@ -0,0 +1,48 @@
require "test_helper"
class ChecklistsControllerTest < ActionDispatch::IntegrationTest
setup do
@checklist = checklists(:one)
end
test "should get index" do
get checklists_url
assert_response :success
end
test "should get new" do
get new_checklist_url
assert_response :success
end
test "should create checklist" do
assert_difference("Checklist.count") do
post checklists_url, params: { checklist: { code: @checklist.code, description: @checklist.description, name: @checklist.name } }
end
assert_redirected_to checklist_url(Checklist.last)
end
test "should show checklist" do
get checklist_url(@checklist)
assert_response :success
end
test "should get edit" do
get edit_checklist_url(@checklist)
assert_response :success
end
test "should update checklist" do
patch checklist_url(@checklist), params: { checklist: { code: @checklist.code, description: @checklist.description, name: @checklist.name } }
assert_redirected_to checklist_url(@checklist)
end
test "should destroy checklist" do
assert_difference("Checklist.count", -1) do
delete checklist_url(@checklist)
end
assert_redirected_to checklists_url
end
end

View file

@ -0,0 +1,48 @@
require "test_helper"
class ChecksControllerTest < ActionDispatch::IntegrationTest
setup do
@check = checks(:one)
end
test "should get index" do
get checks_url
assert_response :success
end
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 } }
end
assert_redirected_to check_url(Check.last)
end
test "should show check" do
get check_url(@check)
assert_response :success
end
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 } }
assert_redirected_to check_url(@check)
end
test "should destroy check" do
assert_difference("Check.count", -1) do
delete check_url(@check)
end
assert_redirected_to checks_url
end
end

View file

@ -0,0 +1,48 @@
require "test_helper"
class ElementsControllerTest < ActionDispatch::IntegrationTest
setup do
@element = elements(:one)
end
test "should get index" do
get elements_url
assert_response :success
end
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 } }
end
assert_redirected_to element_url(Element.last)
end
test "should show element" do
get element_url(@element)
assert_response :success
end
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 } }
assert_redirected_to element_url(@element)
end
test "should destroy element" do
assert_difference("Element.count", -1) do
delete element_url(@element)
end
assert_redirected_to elements_url
end
end

View file

@ -0,0 +1,48 @@
require "test_helper"
class ReportsControllerTest < ActionDispatch::IntegrationTest
setup do
@report = reports(:one)
end
test "should get index" do
get reports_url
assert_response :success
end
test "should get new" do
get new_report_url
assert_response :success
end
test "should create report" do
assert_difference("Report.count") do
post reports_url, params: { report: { comment: @report.comment, name: @report.name } }
end
assert_redirected_to report_url(Report.last)
end
test "should show report" do
get report_url(@report)
assert_response :success
end
test "should get edit" do
get edit_report_url(@report)
assert_response :success
end
test "should update report" do
patch report_url(@report), params: { report: { comment: @report.comment, name: @report.name } }
assert_redirected_to report_url(@report)
end
test "should destroy report" do
assert_difference("Report.count", -1) do
delete report_url(@report)
end
assert_redirected_to reports_url
end
end

View file

@ -0,0 +1,48 @@
require "test_helper"
class SuccessCriteriaControllerTest < ActionDispatch::IntegrationTest
setup do
@success_criterion = success_criteria(:one)
end
test "should get index" do
get success_criteria_url
assert_response :success
end
test "should get new" do
get new_success_criterion_url
assert_response :success
end
test "should create success_criterion" do
assert_difference("SuccessCriterion.count") do
post success_criteria_url, params: { success_criterion: { comment: @success_criterion.comment, description: @success_criterion.description, element_id: @success_criterion.element_id, level: @success_criterion.level, result: @success_criterion.result, title: @success_criterion.title } }
end
assert_redirected_to success_criterion_url(SuccessCriterion.last)
end
test "should show success_criterion" do
get success_criterion_url(@success_criterion)
assert_response :success
end
test "should get edit" do
get edit_success_criterion_url(@success_criterion)
assert_response :success
end
test "should update success_criterion" do
patch success_criterion_url(@success_criterion), params: { success_criterion: { comment: @success_criterion.comment, description: @success_criterion.description, element_id: @success_criterion.element_id, level: @success_criterion.level, result: @success_criterion.result, title: @success_criterion.title } }
assert_redirected_to success_criterion_url(@success_criterion)
end
test "should destroy success_criterion" do
assert_difference("SuccessCriterion.count", -1) do
delete success_criterion_url(@success_criterion)
end
assert_redirected_to success_criteria_url
end
end

11
test/fixtures/checklist_entries.yml vendored Normal file
View file

@ -0,0 +1,11 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
checklist: one
check: one
position: 1
two:
checklist: two
check: two
position: 1

11
test/fixtures/checklists.yml vendored Normal file
View file

@ -0,0 +1,11 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
code: MyString
name: MyString
description: MyText
two:
code: MyString
name: MyString
description: MyText

13
test/fixtures/checks.yml vendored Normal file
View file

@ -0,0 +1,13 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
position: MyString
name: MyString
success_criterion: MyText
level: 1
two:
position: MyString
name: MyString
success_criterion: MyText
level: 1

13
test/fixtures/elements.yml vendored Normal file
View file

@ -0,0 +1,13 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
report: one
path: MyString
title: MyString
description: MyText
two:
report: two
path: MyString
title: MyString
description: MyText

9
test/fixtures/reports.yml vendored Normal file
View file

@ -0,0 +1,9 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
comment: MyText
two:
name: MyString
comment: MyText

17
test/fixtures/success_criteria.yml vendored Normal file
View file

@ -0,0 +1,17 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
element: one
title: MyString
description: MyText
level: 1
result: 1
comment: MyText
two:
element: two
title: MyString
description: MyText
level: 1
result: 1
comment: MyText

View file

@ -0,0 +1,7 @@
require "test_helper"
class CheckTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View file

@ -0,0 +1,7 @@
require "test_helper"
class ChecklistEntryTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View file

@ -0,0 +1,7 @@
require "test_helper"
class ChecklistTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View file

@ -0,0 +1,7 @@
require "test_helper"
class ElementTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View file

@ -0,0 +1,7 @@
require "test_helper"
class ReportTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View file

@ -0,0 +1,7 @@
require "test_helper"
class SuccessCriterionTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View file

@ -0,0 +1,45 @@
require "application_system_test_case"
class ChecklistsTest < ApplicationSystemTestCase
setup do
@checklist = checklists(:one)
end
test "visiting the index" do
visit checklists_url
assert_selector "h1", text: "Checklists"
end
test "should create checklist" do
visit checklists_url
click_on "New checklist"
fill_in "Code", with: @checklist.code
fill_in "Description", with: @checklist.description
fill_in "Name", with: @checklist.name
click_on "Create Checklist"
assert_text "Checklist was successfully created"
click_on "Back"
end
test "should update Checklist" do
visit checklist_url(@checklist)
click_on "Edit this checklist", match: :first
fill_in "Code", with: @checklist.code
fill_in "Description", with: @checklist.description
fill_in "Name", with: @checklist.name
click_on "Update Checklist"
assert_text "Checklist was successfully updated"
click_on "Back"
end
test "should destroy Checklist" do
visit checklist_url(@checklist)
click_on "Destroy this checklist", match: :first
assert_text "Checklist was successfully destroyed"
end
end

View file

@ -0,0 +1,47 @@
require "application_system_test_case"
class ChecksTest < ApplicationSystemTestCase
setup do
@check = checks(:one)
end
test "visiting the index" do
visit checks_url
assert_selector "h1", text: "Checks"
end
test "should create check" do
visit checks_url
click_on "New check"
fill_in "Level", with: @check.level
fill_in "Name", with: @check.name
fill_in "Position", with: @check.position
fill_in "Success criterion", with: @check.success_criterion
click_on "Create Check"
assert_text "Check was successfully created"
click_on "Back"
end
test "should update Check" do
visit check_url(@check)
click_on "Edit this check", match: :first
fill_in "Level", with: @check.level
fill_in "Name", with: @check.name
fill_in "Position", with: @check.position
fill_in "Success criterion", with: @check.success_criterion
click_on "Update Check"
assert_text "Check was successfully updated"
click_on "Back"
end
test "should destroy Check" do
visit check_url(@check)
click_on "Destroy this check", match: :first
assert_text "Check was successfully destroyed"
end
end

View file

@ -0,0 +1,47 @@
require "application_system_test_case"
class ElementsTest < ApplicationSystemTestCase
setup do
@element = elements(:one)
end
test "visiting the index" do
visit elements_url
assert_selector "h1", text: "Elements"
end
test "should create element" do
visit elements_url
click_on "New element"
fill_in "Description", with: @element.description
fill_in "Path", with: @element.path
fill_in "Report", with: @element.report_id
fill_in "Title", with: @element.title
click_on "Create Element"
assert_text "Element was successfully created"
click_on "Back"
end
test "should update Element" do
visit element_url(@element)
click_on "Edit this element", match: :first
fill_in "Description", with: @element.description
fill_in "Path", with: @element.path
fill_in "Report", with: @element.report_id
fill_in "Title", with: @element.title
click_on "Update Element"
assert_text "Element was successfully updated"
click_on "Back"
end
test "should destroy Element" do
visit element_url(@element)
click_on "Destroy this element", match: :first
assert_text "Element was successfully destroyed"
end
end

View file

@ -0,0 +1,43 @@
require "application_system_test_case"
class ReportsTest < ApplicationSystemTestCase
setup do
@report = reports(:one)
end
test "visiting the index" do
visit reports_url
assert_selector "h1", text: "Reports"
end
test "should create report" do
visit reports_url
click_on "New report"
fill_in "Comment", with: @report.comment
fill_in "Name", with: @report.name
click_on "Create Report"
assert_text "Report was successfully created"
click_on "Back"
end
test "should update Report" do
visit report_url(@report)
click_on "Edit this report", match: :first
fill_in "Comment", with: @report.comment
fill_in "Name", with: @report.name
click_on "Update Report"
assert_text "Report was successfully updated"
click_on "Back"
end
test "should destroy Report" do
visit report_url(@report)
click_on "Destroy this report", match: :first
assert_text "Report was successfully destroyed"
end
end

View file

@ -0,0 +1,51 @@
require "application_system_test_case"
class SuccessCriteriaTest < ApplicationSystemTestCase
setup do
@success_criterion = success_criteria(:one)
end
test "visiting the index" do
visit success_criteria_url
assert_selector "h1", text: "Success criteria"
end
test "should create success criterion" do
visit success_criteria_url
click_on "New success criterion"
fill_in "Comment", with: @success_criterion.comment
fill_in "Description", with: @success_criterion.description
fill_in "Element", with: @success_criterion.element_id
fill_in "Level", with: @success_criterion.level
fill_in "Result", with: @success_criterion.result
fill_in "Title", with: @success_criterion.title
click_on "Create Success criterion"
assert_text "Success criterion was successfully created"
click_on "Back"
end
test "should update Success criterion" do
visit success_criterion_url(@success_criterion)
click_on "Edit this success criterion", match: :first
fill_in "Comment", with: @success_criterion.comment
fill_in "Description", with: @success_criterion.description
fill_in "Element", with: @success_criterion.element_id
fill_in "Level", with: @success_criterion.level
fill_in "Result", with: @success_criterion.result
fill_in "Title", with: @success_criterion.title
click_on "Update Success criterion"
assert_text "Success criterion was successfully updated"
click_on "Back"
end
test "should destroy Success criterion" do
visit success_criterion_url(@success_criterion)
click_on "Destroy this success criterion", match: :first
assert_text "Success criterion was successfully destroyed"
end
end