Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refs #36849 - Ruby 3 preparations #9975

Merged
merged 3 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def show_parent?(obj)
end

def documentation_button(section = "", options = {})
url = documentation_url section, options
url = documentation_url(section, **options)
link_to(icon_text('help', _('Documentation'), :kind => 'pficon'),
url, :rel => 'external noopener noreferrer', :class => 'btn btn-default btn-docs', :target => '_blank')
end
Expand Down
8 changes: 4 additions & 4 deletions db/migrate/20150525081931_remove_duplicate_tokens.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
class RemoveDuplicateTokens < ActiveRecord::Migration[4.2]
def up
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
remove_index :tokens, :host_id if index_exists? :tokens, :host_id
add_index :tokens, :host_id, :unique => true
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
end

def down
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
remove_index :tokens, :host_id if index_exists? :tokens, :host_id
add_index :tokens, :host_id
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
end
end
8 changes: 4 additions & 4 deletions db/migrate/20180613100703_add_type_to_token.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
class AddTypeToToken < ActiveRecord::Migration[5.1]
def up
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
remove_index :tokens, :host_id if index_exists? :tokens, :host_id # was unique
add_index :tokens, :host_id
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
add_column :tokens, :type, :string, default: 'Token::Build', null: false, index: true
change_column :tokens, :value, :text
end

def down
change_column :tokens, :value, :string, limit: 255
remove_column :tokens, :type
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
remove_index :tokens, :host_id if index_exists? :tokens, :host_id
add_index :tokens, :host_id, :unique => true
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
end
end
2 changes: 1 addition & 1 deletion test/controllers/home_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class HomeControllerTest < ActionController::TestCase
test "should get status without an error" do
get :status, {:format => "json"}
get :status, :format => "json"
assert_response :success
end
end
2 changes: 1 addition & 1 deletion test/unit/setting_manager_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class SettingManagerTest < ActiveSupport::TestCase
default: '[email protected]',
description: 'This is nicely described foo setting',
full_name: 'Foo setting')
validates(:validfoo, email: true)
validates(:validfoo, { email: true })
end
end
Foreman::SettingManager.validations.setup!
Expand Down
6 changes: 3 additions & 3 deletions test/unit/tasks/interfaces_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class InterfacesTest < ActiveSupport::TestCase
end

assert_match /cleaned 0 interfaces/, stdout
encoded_hostname = URI.encode("(#{host.name})")
encoded_hostname = CGI.escape("(#{host.name})")
assert_match /#{encoded_hostname}/, stdout
assert_match /ignored interface set as primary/, stdout
end
Expand All @@ -49,9 +49,9 @@ class InterfacesTest < ActiveSupport::TestCase
end

assert_match /cleaned 0 interfaces/, stdout
encoded_hostname = URI.encode("(#{host.name})")
encoded_hostname = CGI.escape("(#{host.name})")
assert_match /#{encoded_hostname}/, stdout
query = URI.decode(stdout.match(/^.*search=(.*?%29)/)[1]).tr('+', ' ')
query = CGI.unescape(stdout.match(/^.*search=(.*?%29)/)[1]).tr('+', ' ')
assert_equal host.id, Host.search_for(query).first.id
assert_match /ignored interface set as provision/, stdout
end
Expand Down
Loading