Skip to content

Commit

Permalink
lint a random file
Browse files Browse the repository at this point in the history
  • Loading branch information
osc-bot committed Dec 7, 2024
1 parent 9d372e4 commit 96a6407
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions apps/dashboard/test/integration/custom_pages_integration_test.rb
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
# frozen_string_literal: true

require 'test_helper'

class CustomPagesIntegrationTest < ActionDispatch::IntegrationTest

test "should render configured page layout" do
test 'should render configured page layout' do
stub_user_configuration({
custom_pages: {
docs: {
rows: [
{columns: [
{
widgets: 'custom_pages_test'
}
]},
{columns: [
{
width: 8,
widgets: 'custom_pages_test'
}
]}
]
}
}
})

get custom_pages_path(page_code: "docs")
custom_pages: {
docs: {
rows: [
{ columns: [
{
widgets: 'custom_pages_test'
}
] },
{ columns: [
{
width: 8,
widgets: 'custom_pages_test'
}
] }
]
}
}
})

get custom_pages_path(page_code: 'docs')

assert :success
assert_select 'div.row', 2
assert_select 'div.row > div.col-md-12', 1
assert_select 'div.row > div.col-md-12 > h3', text: "Custom Pages Test Widget"
assert_select 'div.row > div.col-md-12 > h3', text: 'Custom Pages Test Widget'
assert_select 'div.row > div.col-md-8', 1
assert_select 'div.row > div.col-md-8 > h3', text: "Custom Pages Test Widget"
assert_select 'div.row > div.col-md-8 > h3', text: 'Custom Pages Test Widget'
end

test "should render error message when page is not found" do
stub_user_configuration({custom_pages: {}})
test 'should render error message when page is not found' do
stub_user_configuration({ custom_pages: {} })

get custom_pages_path(page_code: "not_defined")
get custom_pages_path(page_code: 'not_defined')

assert :success
# There should be 3 alert-danger divs
Expand All @@ -45,9 +46,7 @@ class CustomPagesIntegrationTest < ActionDispatch::IntegrationTest
# custom page not found
assert_select "div.alert-danger[role='alert']", 3
assert_select "div.alert-danger[role='alert']" do |elements|
assert_match /Invalid page code: not_defined/, elements[2].text
assert_match(/Invalid page code: not_defined/, elements[2].text)
end
end


end
end

0 comments on commit 96a6407

Please sign in to comment.