Links, mainly...
This commit is contained in:
parent
fd42a3f173
commit
21ab02d647
69 changed files with 2258 additions and 155 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
49
test/controllers/link_categories_controller_test.rb
Normal file
49
test/controllers/link_categories_controller_test.rb
Normal 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
|
||||
48
test/controllers/links_controller_test.rb
Normal file
48
test/controllers/links_controller_test.rb
Normal 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
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
2
test/fixtures/checklists.yml
vendored
2
test/fixtures/checklists.yml
vendored
|
|
@ -3,9 +3,7 @@
|
|||
one:
|
||||
code: MyString
|
||||
name: MyString
|
||||
description: MyText
|
||||
|
||||
two:
|
||||
code: MyString
|
||||
name: MyString
|
||||
description: MyText
|
||||
|
|
|
|||
5
test/fixtures/checks.yml
vendored
5
test/fixtures/checks.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
4
test/fixtures/elements.yml
vendored
4
test/fixtures/elements.yml
vendored
|
|
@ -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
14
test/fixtures/link_categories.yml
vendored
Normal 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
15
test/fixtures/links.yml
vendored
Normal 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
|
||||
2
test/fixtures/reports.yml
vendored
2
test/fixtures/reports.yml
vendored
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
one:
|
||||
name: MyString
|
||||
comment: MyText
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
comment: MyText
|
||||
|
|
|
|||
4
test/fixtures/success_criteria.yml
vendored
4
test/fixtures/success_criteria.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
7
test/models/link_category_test.rb
Normal file
7
test/models/link_category_test.rb
Normal 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
7
test/models/link_test.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
require "test_helper"
|
||||
|
||||
class LinkTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class ChecksTest < ApplicationSystemTestCase
|
|||
end
|
||||
|
||||
test 'fail' do
|
||||
skip
|
||||
assert false
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
36
test/system/link_categories_test.rb
Normal file
36
test/system/link_categories_test.rb
Normal 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
37
test/system/links_test.rb
Normal 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
|
||||
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue