Skip to content

Commit

Permalink
Support Rails 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ofedoren authored and evgeni committed Nov 13, 2024
1 parent e2cbb85 commit 343c1b9
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 44 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ Style/FrozenStringLiteralComment:
# Support both ruby19 and hash_rockets
Style/HashSyntax:
Enabled: false

Metrics/BlockLength:
Enabled: false
6 changes: 0 additions & 6 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,6 @@ Lint/Void:
Metrics/AbcSize:
Max: 21

# Offense count: 4
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
# IgnoredMethods: refine
Metrics/BlockLength:
Max: 31

# Offense count: 1
# Configuration parameters: IgnoredMethods.
Metrics/CyclomaticComplexity:
Expand Down
5 changes: 3 additions & 2 deletions app/models/concerns/realm_theme.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ module RealmTheme
Realm.class_eval do
_validators.delete(:realm_type)
_validate_callbacks.each do |callback|
if callback.raw_filter.respond_to? :attributes
callback.raw_filter.attributes.delete :realm_type
filter_method = callback.respond_to?(:raw_filter) ? :raw_filter : :filter
if callback.send(filter_method).respond_to? :attributes
callback.send(filter_method).attributes.delete :realm_type
end
end
validates :realm_type, :presence => true, :inclusion => { :in => ["Red Hat Identity Management", "Active Directory"] }
Expand Down
2 changes: 1 addition & 1 deletion app/overrides/layouts/base/theme_resources.html.erb.deface
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<%= javascript_include_tag('foreman_theme_satellite/theme_ng_page_title') %>
<%= webpacked_plugins_js_for :'foreman_theme_satellite' %>
<%= javascript_tag do %>
<%= render("foreman_theme_satellite/theme_client_side_branding.js") %>
<%= render(partial: "foreman_theme_satellite/theme_client_side_branding", formats: :js) %>
<% end %>
66 changes: 34 additions & 32 deletions lib/foreman_theme_satellite/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,42 @@ class Engine < ::Rails::Engine
config.eager_load_paths += Dir["#{config.root}/lib"]

initializer 'foreman_theme_satellite.register_plugin', :before=> :finisher_hook do |app|
Foreman::Plugin.register :foreman_theme_satellite do
requires_foreman '>= 3.13.0'
register_gettext

settings do
category(:provisioning) do
setting('show_unsupported_templates',
type: :boolean,
default: true,
description: N_('Show unsupported provisioning templates. '\
'When enabled, all the avaiable templates will be shown. '\
'When disabled, Red Hat supported templates will be shown only'),
full_name: N_('Show unsupported provisioning templates')
)
app.reloader.to_prepare do
Foreman::Plugin.register :foreman_theme_satellite do
requires_foreman '>= 3.13.0'
register_gettext

settings do
category(:provisioning) do
setting('show_unsupported_templates',
type: :boolean,
default: true,
description: N_('Show unsupported provisioning templates. '\
'When enabled, all the avaiable templates will be shown. '\
'When disabled, Red Hat supported templates will be shown only'),
full_name: N_('Show unsupported provisioning templates')
)
end
end
end

tests_to_skip ({
"ComputeResourceTest" => ["friendly provider name"],
"RealmIntegrationTest" => ["create new page"],
"SmartProxyIntegrationTest" => ["create new page", "index page"],
"TopBarIntegrationTest" => ["top bar links"],
"AboutIntegrationTest" => ["about page"],
"ComputeProfileIntegrationTest" => ["index page", "create new page", "edit page", "show page", "edit compute attribute page", "new compute attribute page"] ,

#the following tests are failing due to change in realms types
"Api::V2::RealmsControllerTest" => ["should create valid realm", "should update valid realm"],
"OrganizationTest" => ["should clone organization with all associations"],
"RealmTest" => ["realm can be assigned to locations"],
"LocationTest" => ["should clone location with all associations"]
})

extend_rabl_template 'api/v2/home/status', 'api/v2/home/status_extensions'
extend_template_helpers ForemanThemeSatellite::RendererMethods
tests_to_skip ({
"ComputeResourceTest" => ["friendly provider name"],
"RealmIntegrationTest" => ["create new page"],
"SmartProxyIntegrationTest" => ["create new page", "index page"],
"TopBarIntegrationTest" => ["top bar links"],
"AboutIntegrationTest" => ["about page"],
"ComputeProfileIntegrationTest" => ["index page", "create new page", "edit page", "show page", "edit compute attribute page", "new compute attribute page"] ,

#the following tests are failing due to change in realms types
"Api::V2::RealmsControllerTest" => ["should create valid realm", "should update valid realm"],
"OrganizationTest" => ["should clone organization with all associations"],
"RealmTest" => ["realm can be assigned to locations"],
"LocationTest" => ["should clone location with all associations"]
})

extend_rabl_template 'api/v2/home/status', 'api/v2/home/status_extensions'
extend_template_helpers ForemanThemeSatellite::RendererMethods
end
end
end

Expand Down
4 changes: 1 addition & 3 deletions test/unit/setting_registry_branding_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'test_plugin_helper'

class SettingRegistryBrandingTest < ActiveSupport::TestCase
# rubocop:disable Metrics/BlockLength
describe 'stubbed creation' do
test 'it replaces value to a branded one using DSL' do
Setting.where(name: 'dsl_setting').delete_all
Expand Down Expand Up @@ -44,7 +43,6 @@ class SettingRegistryBrandingTest < ActiveSupport::TestCase
assert_nil Setting['test_setting']
end
end
# rubocop:enable Metrics/BlockLength
end

class SettingBrandingTest < ActiveSupport::TestCase
Expand All @@ -53,4 +51,4 @@ class SettingBrandingTest < ActiveSupport::TestCase
Rails.logger.expects(:debug).with('Setting \'test_setting\' is not available in Satellite; ignoring')
Setting['test_setting']
end
end
end

0 comments on commit 343c1b9

Please sign in to comment.