mirror of
https://github.com/we-promise/sure.git
synced 2026-07-19 08:15:21 +00:00
Merge branch 'we-promise:main' into Transfer-charges
This commit is contained in:
@@ -14,6 +14,35 @@ class PagesControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :ok
|
||||
end
|
||||
|
||||
test "update_preferences persists dashboard section layout height" do
|
||||
patch "/dashboard/preferences", params: {
|
||||
preferences: { dashboard_section_layout: { net_worth_chart: { height: "compact" } } }
|
||||
}, as: :json
|
||||
|
||||
assert_response :ok
|
||||
assert_equal "compact", @user.reload.dashboard_section_height("net_worth_chart")
|
||||
end
|
||||
|
||||
test "update_preferences persists dashboard section width" do
|
||||
patch "/dashboard/preferences", params: {
|
||||
preferences: { dashboard_section_layout: { cashflow_sankey: { col_span: "single" } } }
|
||||
}, as: :json
|
||||
|
||||
assert_response :ok
|
||||
assert_equal "single", @user.reload.dashboard_section_width("cashflow_sankey")
|
||||
end
|
||||
|
||||
test "update_preferences ignores malformed dashboard_section_layout without erroring" do
|
||||
previous_height = @user.reload.dashboard_section_height("net_worth_chart")
|
||||
|
||||
patch "/dashboard/preferences", params: {
|
||||
preferences: { dashboard_section_layout: "not-a-hash" }
|
||||
}, as: :json
|
||||
|
||||
assert_response :ok
|
||||
assert_equal previous_height, @user.reload.dashboard_section_height("net_worth_chart")
|
||||
end
|
||||
|
||||
test "dashboard memoizes income statement period totals while rendering" do
|
||||
income_statement = IncomeStatement.new(@family)
|
||||
IncomeStatement.stubs(:new).returns(income_statement)
|
||||
|
||||
34
test/controllers/settings/securities_controller_test.rb
Normal file
34
test/controllers/settings/securities_controller_test.rb
Normal file
@@ -0,0 +1,34 @@
|
||||
require "test_helper"
|
||||
|
||||
class Settings::SecuritiesControllerTest < ActionDispatch::IntegrationTest
|
||||
setup { sign_in users(:family_admin) }
|
||||
|
||||
test "shows encryption warning when self-hosted and encryption is not configured" do
|
||||
Rails.configuration.stubs(:app_mode).returns("self_hosted".inquiry)
|
||||
ActiveRecordEncryptionConfig.stubs(:explicitly_configured?).returns(false)
|
||||
|
||||
get settings_security_url
|
||||
|
||||
assert_response :success
|
||||
assert_includes response.body, I18n.t("settings.securities.show.encryption_warning.title")
|
||||
end
|
||||
|
||||
test "hides encryption warning when encryption is configured" do
|
||||
Rails.configuration.stubs(:app_mode).returns("self_hosted".inquiry)
|
||||
ActiveRecordEncryptionConfig.stubs(:explicitly_configured?).returns(true)
|
||||
|
||||
get settings_security_url
|
||||
|
||||
assert_response :success
|
||||
assert_not_includes response.body, I18n.t("settings.securities.show.encryption_warning.title")
|
||||
end
|
||||
|
||||
test "does not show encryption warning in managed mode" do
|
||||
Rails.configuration.stubs(:app_mode).returns("managed".inquiry)
|
||||
|
||||
get settings_security_url
|
||||
|
||||
assert_response :success
|
||||
assert_not_includes response.body, I18n.t("settings.securities.show.encryption_warning.title")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user