Links, mainly...
Some checks failed
/ Run system tests (push) Waiting to run
/ Build, push and deploy image (push) Blocked by required conditions
/ Run tests (push) Has been cancelled
/ Checkout (push) Successful in 8m9s

This commit is contained in:
david 2024-07-26 00:59:00 +02:00
parent fd42a3f173
commit 21ab02d647
69 changed files with 2258 additions and 155 deletions

View file

@ -17,7 +17,7 @@ class ChecklistsControllerTest < ActionDispatch::IntegrationTest
test "should create checklist" do
assert_difference("Checklist.count") do
post checklists_url, params: { checklist: { code: @checklist.code, description: @checklist.description, name: @checklist.name } }
post checklists_url, params: { checklist: { code: @checklist.code, description_html: @checklist.description_html, name: @checklist.name } }
end
assert_redirected_to checklist_url(Checklist.last)
@ -34,7 +34,7 @@ class ChecklistsControllerTest < ActionDispatch::IntegrationTest
end
test "should update checklist" do
patch checklist_url(@checklist), params: { checklist: { code: @checklist.code, description: @checklist.description, name: @checklist.name } }
patch checklist_url(@checklist), params: { checklist: { code: @checklist.code, description_html: @checklist.description_html, name: @checklist.name } }
assert_redirected_to checklist_url(@checklist)
end

View file

@ -19,7 +19,7 @@ class ChecksControllerTest < ActionDispatch::IntegrationTest
assert_difference('Check.count') do
post checks_url,
params: { check: { level: @check.level, name: @check.name, position: @check.position,
success_criterion: @check.success_criterion } }
success_criterion_html: @check.success_criterion_html } }
end
assert_redirected_to check_url(Check.last)
@ -38,7 +38,7 @@ class ChecksControllerTest < ActionDispatch::IntegrationTest
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 } }
success_criterion_html: @check.success_criterion_html } }
assert_redirected_to check_url(@check)
end

View file

@ -19,7 +19,7 @@ class ElementsControllerTest < ActionDispatch::IntegrationTest
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,
params: { element: { description_html: @element.description_html, path: @element.path, report_id: @element.report_id,
title: @element.title, checklist_id: @checklist.id } }
end
@ -38,7 +38,7 @@ class ElementsControllerTest < ActionDispatch::IntegrationTest
test 'should update element' do
patch element_url(@element),
params: { element: { description: @element.description, path: @element.path, report_id: @element.report_id,
params: { element: { description_html: @element.description_html, path: @element.path, report_id: @element.report_id,
title: @element.title } }
assert_redirected_to element_url(@element)
end

View file

@ -0,0 +1,49 @@
require "test_helper"
class LinkCategoriesControllerTest < ActionDispatch::IntegrationTest
setup do
@link_category = link_categories(:one)
end
test "should get index" do
get link_categories_url
assert_response :success
end
test "should get new" do
get new_link_category_url
assert_response :success
end
test "should create link_category" do
assert_difference("LinkCategory.count") do
post link_categories_url, params: { link_category: { description: @link_category.description, name: @link_category.name } }
end
assert_redirected_to link_category_url(LinkCategory.last)
end
test "should show link_category" do
get link_category_url(@link_category)
assert_response :success
end
test "should get edit" do
get edit_link_category_url(@link_category)
assert_response :success
end
test "should update link_category" do
patch link_category_url(@link_category), params: { link_category: { description: @link_category.description, name: @link_category.name } }
assert_redirected_to link_category_url(@link_category)
end
test "should destroy link_category" do
assert_difference("LinkCategory.count", -1) do
link_category = link_categories(:deletable)
delete link_category_url(link_category)
end
assert_redirected_to link_categories_url
end
end

View file

@ -0,0 +1,48 @@
require "test_helper"
class LinksControllerTest < ActionDispatch::IntegrationTest
setup do
@link = links(:one)
end
test "should get index" do
get links_url
assert_response :success
end
test "should get new" do
get new_link_url
assert_response :success
end
test "should create link" do
assert_difference("Link.count") do
post links_url, params: { link: { fail_count: @link.fail_count, last_check_at: @link.last_check_at, link_category_id: @link.link_category_id, text: @link.text, url: @link.url } }
end
assert_redirected_to link_url(Link.last)
end
test "should show link" do
get link_url(@link)
assert_response :success
end
test "should get edit" do
get edit_link_url(@link)
assert_response :success
end
test "should update link" do
patch link_url(@link), params: { link: { fail_count: @link.fail_count, last_check_at: @link.last_check_at, link_category_id: @link.link_category_id, text: @link.text, url: @link.url } }
assert_redirected_to link_url(@link)
end
test "should destroy link" do
assert_difference("Link.count", -1) do
delete link_url(@link)
end
assert_redirected_to links_url
end
end

View file

@ -17,7 +17,7 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
test "should create report" do
assert_difference("Report.count") do
post reports_url, params: { report: { comment: @report.comment, name: @report.name } }
post reports_url, params: { report: { comment_html: @report.comment_html, name: @report.name } }
end
assert_redirected_to report_url(Report.last)
@ -34,7 +34,7 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
end
test "should update report" do
patch report_url(@report), params: { report: { comment: @report.comment, name: @report.name } }
patch report_url(@report), params: { report: { comment_html: @report.comment_html, name: @report.name } }
assert_redirected_to report_url(@report)
end

View file

@ -17,7 +17,7 @@ class SuccessCriteriaControllerTest < ActionDispatch::IntegrationTest
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 } }
post success_criteria_url, params: { success_criterion: { comment_html: @success_criterion.comment_html, description_html: @success_criterion.description_html, 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)
@ -34,7 +34,7 @@ class SuccessCriteriaControllerTest < ActionDispatch::IntegrationTest
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 } }
patch success_criterion_url(@success_criterion), params: { success_criterion: { comment_html: @success_criterion.comment_html, description_html: @success_criterion.description_html, 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

View file

@ -3,9 +3,7 @@
one:
code: MyString
name: MyString
description: MyText
two:
code: MyString
name: MyString
description: MyText

View file

@ -3,17 +3,14 @@
one:
position: MyString
name: MyString
success_criterion: MyText
level: 1
two:
position: MyString
name: MyString
success_criterion: MyText
level: 1
deletable:
position: MyString
name: MyString
success_criterion: MyText
level: 1
level: 1

View file

@ -4,10 +4,10 @@ one:
report: one
path: MyString
title: MyString
description: MyText
# description: MyText
two:
report: two
path: MyString
title: MyString
description: MyText
# description: MyText

14
test/fixtures/link_categories.yml vendored Normal file
View file

@ -0,0 +1,14 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: Tools
description: MyString
two:
name: Checklisten
description: MyString
deletable:
name: Delete me
description: please

15
test/fixtures/links.yml vendored Normal file
View file

@ -0,0 +1,15 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
url: https://example.com
text: MyString
last_check_at: 2024-07-25 19:34:33
fail_count: 1
link_category: one
two:
url: https://wikipedia.org
text: MyString
last_check_at: 2024-07-25 19:34:33
fail_count: 1
link_category: two

View file

@ -2,8 +2,6 @@
one:
name: MyString
comment: MyText
two:
name: MyString
comment: MyText

View file

@ -3,15 +3,11 @@
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

@ -1,7 +1,24 @@
require "test_helper"
require 'test_helper'
class ElementTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
test 'level calculation' do
skip
sc1 = success_criteria(:one)
sc2 = success_criteria(:two)
sc3 = success_criteria(:one)
sc4 = success_criteria(:two)
sc5 = success_criteria(:one)
sc6 = success_criteria(:two)
element = elements(:one)
element.success_criteria = [sc1, sc2, sc3, sc4, sc5, sc6]
element.success_criteria.each { _1.passed! }
assert element.level == :A
element.success_criteria.each { _1.result = :passed }
assert element.level == 'A'
end
end

View file

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

7
test/models/link_test.rb Normal file
View file

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

View file

@ -14,7 +14,7 @@ class ChecklistsTest < ApplicationSystemTestCase
visit checklists_url
click_on 'Checkliste hinzufügen'
fill_in_rich_text_area 'Details', with: @checklist.description
fill_in_rich_text_area 'Details', with: @checklist.description_html
fill_in 'Überschrift', with: @checklist.name
click_on 'Checkliste erstellen'
end
@ -23,7 +23,7 @@ class ChecklistsTest < ApplicationSystemTestCase
visit checklist_url(@checklist)
click_on 'Checkliste bearbeiten', match: :first
fill_in_rich_text_area 'Details', with: @checklist.description
fill_in_rich_text_area 'Details', with: @checklist.description_html
fill_in 'Überschrift', with: @checklist.name
click_on 'Checkliste aktualisieren'
end

View file

@ -39,6 +39,7 @@ class ChecksTest < ApplicationSystemTestCase
end
test 'fail' do
skip
assert false
end
end

View file

@ -14,7 +14,7 @@ class ElementsTest < ApplicationSystemTestCase
visit elements_url
click_on 'Element hinzufügen'
fill_in_rich_text_area 'Details', with: @element.description
fill_in_rich_text_area 'Details', with: @element.description_html
fill_in 'Pfad', with: @element.path
fill_in 'Beschreibung', with: @element.title
click_on 'Element erstellen'
@ -24,7 +24,7 @@ class ElementsTest < ApplicationSystemTestCase
visit element_url(@element)
click_on 'Element bearbeiten', match: :first
fill_in_rich_text_area 'Details', with: @element.description
fill_in_rich_text_area 'Details', with: @element.description_html
fill_in 'Pfad', with: @element.path
fill_in 'Beschreibung', with: @element.title
click_on 'Element aktualisieren'

View file

@ -0,0 +1,36 @@
require 'application_system_test_case'
class LinkCategoriesTest < ApplicationSystemTestCase
setup do
@link_category = link_categories(:one)
end
test 'visiting the index' do
visit link_categories_url
assert_selector 'h1', text: 'Linkkategorien'
end
test 'should create Linkkategorie' do
visit link_categories_url
click_on 'Linkkategorie hinzufügen'
fill_in_rich_text_area 'Beschreibung', with: @link_category.description_html
fill_in 'Name', with: @link_category.name
click_on 'Linkkategorie erstellen'
end
test 'should update Link category' do
visit link_category_url(@link_category)
click_on 'Linkkategorie bearbeiten', match: :first
fill_in_rich_text_area 'Beschreibung', with: @link_category.description_html
fill_in 'Name', with: @link_category.name
click_on 'Linkkategorie aktualisieren'
end
test 'should destroy Link category' do
link_category = link_categories(:deletable)
visit link_category_url(link_category)
click_on 'Linkkategorie löschen', match: :first
end
end

37
test/system/links_test.rb Normal file
View file

@ -0,0 +1,37 @@
require 'application_system_test_case'
class LinksTest < ApplicationSystemTestCase
setup do
@link = links(:one)
end
test 'visiting the index' do
visit links_url
assert_selector 'h1', text: 'Links'
end
test 'should create link' do
visit links_url
click_on 'Link hinzufügen'
select @link.link_category.name, from: 'Kategorie'
fill_in 'Linktext', with: @link.text
fill_in 'Link', with: @link.url
click_on 'Link erstellen'
end
test 'should update Link' do
visit link_url(@link)
click_on 'Link bearbeiten', match: :first
select @link.link_category.name, from: 'Kategorie'
fill_in 'Linktext', with: @link.text
fill_in 'Link', with: @link.url
click_on 'Link aktualisieren'
end
test 'should destroy Link' do
visit link_url(@link)
click_on 'Link löschen', match: :first
end
end

View file

@ -14,8 +14,8 @@ class SuccessCriteriaTest < ApplicationSystemTestCase
visit success_criteria_url
click_on 'Erfolgskriterium hinzufügen'
fill_in_rich_text_area 'Testkommentar', with: @success_criterion.comment
fill_in_rich_text_area 'Richtlinie', with: @success_criterion.description
fill_in_rich_text_area 'Testkommentar', with: @success_criterion.comment_html
fill_in_rich_text_area 'Richtlinie', with: @success_criterion.description_html
# fill_in 'Element', with: @success_criterion.element_id
# fill_in 'Level', with: @success_criterion.level
# fill_in 'Result', with: @success_criterion.result
@ -28,7 +28,7 @@ class SuccessCriteriaTest < ApplicationSystemTestCase
click_on 'Erfolgskriterium bearbeiten', match: :first
fill_in_rich_text_area 'Testkommentar', with: @success_criterion.comment_html
fill_in_rich_text_area 'Richtlinie', with: @success_criterion.description
fill_in_rich_text_area 'Richtlinie', with: @success_criterion.description_html
find('label', text: 'Bestanden', visible: true).click
fill_in 'Titel', with: 'new'
click_on 'Erfolgskriterium aktualisieren'