From 4d61f689ac183a552af8759229562abab901346d Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 4 Jan 2024 21:34:53 +0100 Subject: [PATCH] auto fixes with -A --- rakelib/doc_bootspecs.rake | 2 +- src/examples/boot_req_checker_demo.rb | 1 - src/examples/proposal_settings_dialog.rb | 1 - src/lib/y2partitioner/actions/controllers/filesystem.rb | 2 +- src/lib/y2partitioner/blk_device_restorer.rb | 2 +- src/lib/y2partitioner/dialogs/device_description.rb | 2 +- src/lib/y2partitioner/widgets/blk_devices_table.rb | 2 +- src/lib/y2partitioner/widgets/encrypt_method_options.rb | 2 +- src/lib/y2partitioner/widgets/overview.rb | 2 +- src/lib/y2storage/abstract_device_factory.rb | 2 +- src/lib/y2storage/autoinst_profile/drive_section.rb | 2 +- src/lib/y2storage/autoinst_proposal.rb | 2 +- src/lib/y2storage/blk_device.rb | 2 +- src/lib/y2storage/clients/partitions_proposal.rb | 2 +- src/lib/y2storage/device.rb | 2 +- src/lib/y2storage/dialogs/proposal.rb | 4 ++-- src/lib/y2storage/disk.rb | 2 +- src/lib/y2storage/dump_manager.rb | 2 +- src/lib/y2storage/encryption_processes/pervasive.rb | 2 +- src/lib/y2storage/hwinfo_reader.rb | 2 +- src/lib/y2storage/planned/assigned_space.rb | 2 +- src/lib/y2storage/planned/can_be_resized.rb | 4 +--- src/lib/y2storage/planned/lvm_vg.rb | 2 +- src/lib/y2storage/proposal/autoinst_devices_planner.rb | 2 +- src/lib/y2storage/proposal/partition_table_creator.rb | 2 +- .../proposal/partitions_distribution_calculator.rb | 2 +- src/lib/y2storage/proposal_settings.rb | 2 +- src/lib/y2storage/secret_attributes.rb | 2 +- test/spec_helper.rb | 1 - test/y2partitioner/ui_state_test.rb | 8 ++++---- test/y2storage/actions_presenter_test.rb | 2 +- test/y2storage/dump_manager_test.rb | 2 +- test/y2storage/package_handler_test.rb | 4 ++-- test/y2storage/secret_attributes_test.rb | 1 - test/y2storage/storage_class_wrapper_test.rb | 2 +- 35 files changed, 36 insertions(+), 42 deletions(-) diff --git a/rakelib/doc_bootspecs.rake b/rakelib/doc_bootspecs.rake index a4dfcd5db6..5469efba72 100644 --- a/rakelib/doc_bootspecs.rake +++ b/rakelib/doc_bootspecs.rake @@ -20,7 +20,7 @@ namespace :doc do desc "Build boot requirements spec." task :bootspecs do - files = Dir["**/test/y2storage/boot_requirements_checker_*_test.rb"].sort + files = Dir["**/test/y2storage/boot_requirements_checker_*_test.rb"] unless files.empty? sh "PARALLEL_TESTS=0 rspec" \ " --require ./src/tools/md_formatter.rb" \ diff --git a/src/examples/boot_req_checker_demo.rb b/src/examples/boot_req_checker_demo.rb index 3385cbf66b..ae6d5d7b29 100755 --- a/src/examples/boot_req_checker_demo.rb +++ b/src/examples/boot_req_checker_demo.rb @@ -31,7 +31,6 @@ $LOAD_PATH.unshift(File.expand_path("../lib", __dir__)) require "y2storage" -require "pp" if !Process.euid.zero? warn "You need to run this script as 'root'." diff --git a/src/examples/proposal_settings_dialog.rb b/src/examples/proposal_settings_dialog.rb index 2f0e7fe293..ef011ddafb 100755 --- a/src/examples/proposal_settings_dialog.rb +++ b/src/examples/proposal_settings_dialog.rb @@ -24,7 +24,6 @@ require "yast" require "y2storage" require "y2storage/dialogs/guided_setup" -require "pp" DATA_DIR = "../../test/data" FALLBACK_CONTROL_FILE = DATA_DIR + "/control_files/volumes_ng/control.SLE-with-data.xml" diff --git a/src/lib/y2partitioner/actions/controllers/filesystem.rb b/src/lib/y2partitioner/actions/controllers/filesystem.rb index f43680cf22..fd3c08e132 100644 --- a/src/lib/y2partitioner/actions/controllers/filesystem.rb +++ b/src/lib/y2partitioner/actions/controllers/filesystem.rb @@ -144,7 +144,7 @@ def filesystem # # @return [Y2Storage::Filesystems::Type, nil] nil if there is no filesystem def filesystem_type - filesystem ? filesystem.type : nil + filesystem&.type end # Whether the block device will be formatted, i.e. a new filesystem will diff --git a/src/lib/y2partitioner/blk_device_restorer.rb b/src/lib/y2partitioner/blk_device_restorer.rb index d9faf09d78..cfd0905850 100644 --- a/src/lib/y2partitioner/blk_device_restorer.rb +++ b/src/lib/y2partitioner/blk_device_restorer.rb @@ -219,7 +219,7 @@ def system_device # @return [Y2Storage::BlkDevice, nil] def checkpoint_device checkpoint = DeviceGraphs.instance.checkpoint(device) - dev = checkpoint.nil? ? nil : checkpoint.find_device(device.sid) + dev = checkpoint&.find_device(device.sid) dev || system_device end diff --git a/src/lib/y2partitioner/dialogs/device_description.rb b/src/lib/y2partitioner/dialogs/device_description.rb index 47d4f32950..b070f75aa7 100644 --- a/src/lib/y2partitioner/dialogs/device_description.rb +++ b/src/lib/y2partitioner/dialogs/device_description.rb @@ -127,7 +127,7 @@ def info_widget return @info_widget if @info_widget entry = WIDGETS.find { |k, _v| device.is?(k) } - @info_widget = entry ? entry.last.new(device) : nil + @info_widget = entry&.last&.new(device) end # @see Y2Partitioner::Dialogs::Popup diff --git a/src/lib/y2partitioner/widgets/blk_devices_table.rb b/src/lib/y2partitioner/widgets/blk_devices_table.rb index 3d4b63365a..e7e2d29499 100644 --- a/src/lib/y2partitioner/widgets/blk_devices_table.rb +++ b/src/lib/y2partitioner/widgets/blk_devices_table.rb @@ -76,7 +76,7 @@ def open_items=(value) # @return [Hash{String => Boolean}] same format as {#open_items} def ui_open_items open = Yast::UI.QueryWidget(Id(widget_id), :OpenItems).keys - all_items.map { |i| [i.id, open.include?(i.id) || i.children.none?] }.to_h + all_items.to_h { |i| [i.id, open.include?(i.id) || i.children.none?] } end # Updates table content diff --git a/src/lib/y2partitioner/widgets/encrypt_method_options.rb b/src/lib/y2partitioner/widgets/encrypt_method_options.rb index 187ceb0dcd..df4b44cb2d 100644 --- a/src/lib/y2partitioner/widgets/encrypt_method_options.rb +++ b/src/lib/y2partitioner/widgets/encrypt_method_options.rb @@ -190,7 +190,7 @@ class Luks2Options < LuksOptions # @see LuksOptions#widgets def widgets - super.concat([pbkdf_widget, label_widget]) + super.push(pbkdf_widget, label_widget) end # Widget to set the password-based key derivation function diff --git a/src/lib/y2partitioner/widgets/overview.rb b/src/lib/y2partitioner/widgets/overview.rb index c25fdea067..a75f7d6b97 100644 --- a/src/lib/y2partitioner/widgets/overview.rb +++ b/src/lib/y2partitioner/widgets/overview.rb @@ -122,7 +122,7 @@ def open_items items_with_children = with_children(tree.items) open_items = Yast::UI.QueryWidget(Id(tree.widget_id), :OpenItems).keys - items_with_children.map { |i| [i.to_s, open_items.include?(i)] }.to_h + items_with_children.to_h { |i| [i.to_s, open_items.include?(i)] } end # Checks whether the current page is associated to a specific device diff --git a/src/lib/y2storage/abstract_device_factory.rb b/src/lib/y2storage/abstract_device_factory.rb index 407838c27b..08675c8620 100644 --- a/src/lib/y2storage/abstract_device_factory.rb +++ b/src/lib/y2storage/abstract_device_factory.rb @@ -127,7 +127,7 @@ def build_tree_recursive_from_hash(parent, name, content) # Split up pure parameters and sub-product descriptions sub_prod = content.select { |k, _v| factory_products.include?(k) } - param = content.reject { |k, _v| factory_products.include?(k) } + param = content.except(*factory_products) # Call subclass-defined fixup method if available # to convert known value types to a better usable type diff --git a/src/lib/y2storage/autoinst_profile/drive_section.rb b/src/lib/y2storage/autoinst_profile/drive_section.rb index a250a3ed00..b7fdc34e7d 100644 --- a/src/lib/y2storage/autoinst_profile/drive_section.rb +++ b/src/lib/y2storage/autoinst_profile/drive_section.rb @@ -619,7 +619,7 @@ def use_value_from_string(use) # nil if the root filesystem is not applicable. def enabled_snapshots?(filesystems) root_fs = filesystems.find(&:root?) - return nil if root_fs.nil? || (root_fs.multidevice? && !btrfs_drive_section?) + return false if root_fs.nil? || (root_fs.multidevice? && !btrfs_drive_section?) root_fs.respond_to?(:snapshots?) && root_fs.snapshots? end diff --git a/src/lib/y2storage/autoinst_proposal.rb b/src/lib/y2storage/autoinst_proposal.rb index 842f5dc5e0..d997375fbb 100644 --- a/src/lib/y2storage/autoinst_proposal.rb +++ b/src/lib/y2storage/autoinst_proposal.rb @@ -134,7 +134,7 @@ def suitable_ptable_type(disk, drive_spec) ptable_type = nil ptable_type = Y2Storage::PartitionTables::Type.find(drive_spec.disklabel) if drive_spec.disklabel - disk_ptable_type = disk.partition_table ? disk.partition_table.type : nil + disk_ptable_type = disk.partition_table&.type ptable_type || disk_ptable_type || disk.preferred_ptable_type end diff --git a/src/lib/y2storage/blk_device.rb b/src/lib/y2storage/blk_device.rb index ad43cb9c35..0eae7153fb 100644 --- a/src/lib/y2storage/blk_device.rb +++ b/src/lib/y2storage/blk_device.rb @@ -504,7 +504,7 @@ def part_of_lvm_or_md? # @return [Array] a collection of MD RAIDs, DM RAIDs, volume groups, # multipath, bcache and bcache_cset devices def component_of - vg = lvm_pv ? lvm_pv.lvm_vg : nil + vg = lvm_pv&.lvm_vg fs = (formatted? && filesystem.multidevice?) ? filesystem : nil (dm_raids + [vg, md, multipath, bcache, in_bcache_cset, fs]).compact diff --git a/src/lib/y2storage/clients/partitions_proposal.rb b/src/lib/y2storage/clients/partitions_proposal.rb index 4dbd9563c3..45ff454138 100644 --- a/src/lib/y2storage/clients/partitions_proposal.rb +++ b/src/lib/y2storage/clients/partitions_proposal.rb @@ -114,7 +114,7 @@ def update_state self.staging_revision = storage_manager.staging_revision staging = storage_manager.staging - actiongraph = staging ? staging.actiongraph : nil + actiongraph = staging&.actiongraph self.actions_presenter = ActionsPresenter.new(actiongraph) DumpManager.dump(staging) DumpManager.dump(actions_presenter) diff --git a/src/lib/y2storage/device.rb b/src/lib/y2storage/device.rb index 21e6895f3c..0cd5863a3e 100644 --- a/src/lib/y2storage/device.rb +++ b/src/lib/y2storage/device.rb @@ -362,7 +362,7 @@ def can_resize? # each subclass. # @return [Boolean] def is?(*types) - (types.map(&:to_sym) & types_for_is).any? + types.map(&:to_sym).intersect?(types_for_is) end # Whether there is (or there will be) an entry for this device in the diff --git a/src/lib/y2storage/dialogs/proposal.rb b/src/lib/y2storage/dialogs/proposal.rb index 9ef3681fda..df8cc59631 100644 --- a/src/lib/y2storage/dialogs/proposal.rb +++ b/src/lib/y2storage/dialogs/proposal.rb @@ -297,7 +297,7 @@ def help_text end def settings_adjustment - proposal ? proposal.auto_settings_adjustment : nil + proposal&.auto_settings_adjustment end # Shortcut for Yast::HTML.Para @@ -317,7 +317,7 @@ def list(items) # # @return [Actiongraph, nil] nil if it's not possible to calculate the actions def actiongraph - @devicegraph ? @devicegraph.actiongraph : nil + @devicegraph&.actiongraph rescue ::Storage::Exception => e # TODO: the code capturing the exception and displaying the error pop-up # should not be directly in this dialog. It should be in some common diff --git a/src/lib/y2storage/disk.rb b/src/lib/y2storage/disk.rb index 3b82b96a3a..9fc9509af2 100644 --- a/src/lib/y2storage/disk.rb +++ b/src/lib/y2storage/disk.rb @@ -99,7 +99,7 @@ def systemd_remote? # disk uses a driver that is known to require a daemon to be started in order to make the # device available. See bsc#1176140. log.info "systemd_remote? for #{name}: checking driver - #{driver}" - (SYSTEMD_REMOTE_DRIVERS & driver).any? + SYSTEMD_REMOTE_DRIVERS.intersect?(driver) end # Default partition table type for newly created partition tables diff --git a/src/lib/y2storage/dump_manager.rb b/src/lib/y2storage/dump_manager.rb index 42f486f087..f87cefc919 100644 --- a/src/lib/y2storage/dump_manager.rb +++ b/src/lib/y2storage/dump_manager.rb @@ -285,7 +285,7 @@ def ensure_dump_dir end def clear_dump_dir - FileUtils.remove_dir(dump_dir) if File.exist?(dump_dir) + FileUtils.rm_rf(dump_dir) ensure_dump_dir end diff --git a/src/lib/y2storage/encryption_processes/pervasive.rb b/src/lib/y2storage/encryption_processes/pervasive.rb index d935579da9..5f01802fb2 100644 --- a/src/lib/y2storage/encryption_processes/pervasive.rb +++ b/src/lib/y2storage/encryption_processes/pervasive.rb @@ -94,7 +94,7 @@ def post_commit(device) @secure_key.add_device_and_write(device) unless @secure_key.for_device?(device) zkey_cryptsetup_output = execute_zkey_cryptsetup(device) - commands = zkey_cryptsetup_output[1..-1] + commands = zkey_cryptsetup_output[1..] return if commands.nil? commands.each do |command| diff --git a/src/lib/y2storage/hwinfo_reader.rb b/src/lib/y2storage/hwinfo_reader.rb index f25408d276..073fd2854e 100644 --- a/src/lib/y2storage/hwinfo_reader.rb +++ b/src/lib/y2storage/hwinfo_reader.rb @@ -83,7 +83,7 @@ def data_from_hwinfo lines = output.split(DEVICE_REGEXP).reject(&:empty?) - lines.each_slice(2).each_with_object({}) do |(header, body), data| + lines.each_slice(2).with_object({}) do |(header, body), data| details = data_from_body(body) next if details.device_file.nil? diff --git a/src/lib/y2storage/planned/assigned_space.rb b/src/lib/y2storage/planned/assigned_space.rb index 2f6fe7ab0c..ea3be37b45 100644 --- a/src/lib/y2storage/planned/assigned_space.rb +++ b/src/lib/y2storage/planned/assigned_space.rb @@ -339,7 +339,7 @@ def compare(one, other, attrs, nils_first, descending) if result.zero? if attrs.size > 1 # Try next attribute - compare(one, other, attrs[1..-1], nils_first, descending) + compare(one, other, attrs[1..], nils_first, descending) else # Keep original order by checking the indexes one.last <=> other.last diff --git a/src/lib/y2storage/planned/can_be_resized.rb b/src/lib/y2storage/planned/can_be_resized.rb index 773e2fed14..b7f4531322 100644 --- a/src/lib/y2storage/planned/can_be_resized.rb +++ b/src/lib/y2storage/planned/can_be_resized.rb @@ -68,10 +68,8 @@ def resize_device!(device, resize_info) device.size = if max_size > resize_info.max_size || max_size == DiskSize.unlimited resize_info.max_size - elsif max_size < resize_info.min_size - resize_info.min_size else - max_size + [max_size, resize_info.min_size].max end if max_size != device.size && max_size != DiskSize.unlimited diff --git a/src/lib/y2storage/planned/lvm_vg.rb b/src/lib/y2storage/planned/lvm_vg.rb index edcaa46f70..1fcdd8181e 100644 --- a/src/lib/y2storage/planned/lvm_vg.rb +++ b/src/lib/y2storage/planned/lvm_vg.rb @@ -264,7 +264,7 @@ def self.to_string_attrs # @return [String, nil] def forced_disk_name forced_lv = lvs.find(&:disk) - forced_lv ? forced_lv.disk : nil + forced_lv&.disk end protected diff --git a/src/lib/y2storage/proposal/autoinst_devices_planner.rb b/src/lib/y2storage/proposal/autoinst_devices_planner.rb index 7ea059bfed..66f725963d 100644 --- a/src/lib/y2storage/proposal/autoinst_devices_planner.rb +++ b/src/lib/y2storage/proposal/autoinst_devices_planner.rb @@ -56,7 +56,7 @@ def initialize(devicegraph, issues_list) # @param drives_map [Proposal::AutoinstDrivesMap] Drives map from AutoYaST # @return [Planned::DevicesCollection] def planned_devices(drives_map) - devices = drives_map.each_pair.each_with_object([]) do |(disk_name, drive), memo| + devices = drives_map.each_pair.with_object([]) do |(disk_name, drive), memo| planned_devs = planned_for_drive(drive, disk_name) memo.concat(planned_devs) if planned_devs end diff --git a/src/lib/y2storage/proposal/partition_table_creator.rb b/src/lib/y2storage/proposal/partition_table_creator.rb index 83ebc0b974..05f0f9297d 100644 --- a/src/lib/y2storage/proposal/partition_table_creator.rb +++ b/src/lib/y2storage/proposal/partition_table_creator.rb @@ -52,7 +52,7 @@ def create_or_update(device, planned_ptable_type) # @param planned_ptable_type [Y2Storage::PartitionTables::Type,nil] Wanted partition table type # @return [Y2Storage::PartitionTables::Type] Partition table type def suitable_ptable_type(device, planned_ptable_type) - device_ptable_type = device.partition_table ? device.partition_table.type : nil + device_ptable_type = device.partition_table&.type planned_ptable_type || device_ptable_type || device.preferred_ptable_type end diff --git a/src/lib/y2storage/proposal/partitions_distribution_calculator.rb b/src/lib/y2storage/proposal/partitions_distribution_calculator.rb index b37d314467..fb5831e41d 100644 --- a/src/lib/y2storage/proposal/partitions_distribution_calculator.rb +++ b/src/lib/y2storage/proposal/partitions_distribution_calculator.rb @@ -315,7 +315,7 @@ def hash_product(hash) keys = hash.keys # Ensure same order arrays = keys.map { |key| hash[key] } - product = arrays[0].product(*arrays[1..-1]) + product = arrays[0].product(*arrays[1..]) product.map { |p| keys.zip(p).to_h } end diff --git a/src/lib/y2storage/proposal_settings.rb b/src/lib/y2storage/proposal_settings.rb index be6dc919a0..4e1cc450d5 100644 --- a/src/lib/y2storage/proposal_settings.rb +++ b/src/lib/y2storage/proposal_settings.rb @@ -79,7 +79,7 @@ class ProposalSettings # @return [String, nil] def root_device if allocate_mode?(:device) - root_volume ? root_volume.device : nil + root_volume&.device else @explicit_root_device end diff --git a/src/lib/y2storage/secret_attributes.rb b/src/lib/y2storage/secret_attributes.rb index 731e0240c0..2bd67cd8fa 100644 --- a/src/lib/y2storage/secret_attributes.rb +++ b/src/lib/y2storage/secret_attributes.rb @@ -77,7 +77,7 @@ module ClassMethods def secret_attr(name) define_method(:"#{name}") do attribute = instance_variable_get(:"@#{name}") - attribute ? attribute.value : nil + attribute&.value end define_method(:"#{name}=") do |value| diff --git a/test/spec_helper.rb b/test/spec_helper.rb index 1891a9ac85..87915f69dd 100644 --- a/test/spec_helper.rb +++ b/test/spec_helper.rb @@ -87,7 +87,6 @@ module Installation class ProposalStore; end class ProposalRunner - def initialize(_runner); end def run; end end end diff --git a/test/y2partitioner/ui_state_test.rb b/test/y2partitioner/ui_state_test.rb index f1985f7444..cf3ef45726 100755 --- a/test/y2partitioner/ui_state_test.rb +++ b/test/y2partitioner/ui_state_test.rb @@ -100,7 +100,7 @@ before { ui_state.select_page(page.tree_path) } context "if the disk is still there after redrawing" do - before { pages.concat [page, another_disk_page] } + before { pages.push page, another_disk_page } it "selects the correct disk page" do expect(ui_state.find_page(pages_ids)).to eq page.id @@ -152,7 +152,7 @@ before { ui_state.select_page(page.tree_path) } context "if the VG is still there after redrawing" do - before { pages.concat [page, another_vg_page] } + before { pages.push page, another_vg_page } it "selects the correct VG page" do expect(ui_state.find_page(pages_ids)).to eq page.id @@ -179,7 +179,7 @@ before { ui_state.select_page(page.tree_path) } context "if the bcache is still there after redrawing" do - before { pages.concat [page, another_bcache_page] } + before { pages.push page, another_bcache_page } it "selects the correct bcache page" do expect(ui_state.find_page(pages_ids)).to eq page.id @@ -206,7 +206,7 @@ before { ui_state.select_page(page.tree_path) } context "if the filesystem is still there after redrawing" do - before { pages.concat [page, another_btrfs_page] } + before { pages.push page, another_btrfs_page } it "selects the correct btrfs page" do expect(ui_state.find_page(pages_ids)).to eq page.id diff --git a/test/y2storage/actions_presenter_test.rb b/test/y2storage/actions_presenter_test.rb index 4cb12b6ccc..63c5a4f820 100755 --- a/test/y2storage/actions_presenter_test.rb +++ b/test/y2storage/actions_presenter_test.rb @@ -170,7 +170,7 @@ let(:compound_actions) { [ca_create_device, ca_delete_device] } let(:filename) { "/tmp/saved_actions.txt" } - before { FileUtils.remove(filename) if File.exist?(filename) } + before { FileUtils.rm_f(filename) } after { FileUtils.remove(filename) } it "Saves the actions in a plain text file" do diff --git a/test/y2storage/dump_manager_test.rb b/test/y2storage/dump_manager_test.rb index 2699ab9931..9cf1d492f4 100755 --- a/test/y2storage/dump_manager_test.rb +++ b/test/y2storage/dump_manager_test.rb @@ -81,7 +81,7 @@ def base_dir def dump_dir_list return [] unless File.exist?(base_dir) - Dir.glob(base_dir + "/storage*").sort + Dir.glob(base_dir + "/storage*") end describe "#instance" do diff --git a/test/y2storage/package_handler_test.rb b/test/y2storage/package_handler_test.rb index 92eb4aa786..03ad0070ca 100755 --- a/test/y2storage/package_handler_test.rb +++ b/test/y2storage/package_handler_test.rb @@ -100,7 +100,7 @@ # Let's simulate the first package is already installed allow(Yast::Package).to receive(:Installed).with(feature_pkg[0]).and_return true - expect(Yast::Package).to receive(:DoInstall).with(feature_pkg[1..-1]) + expect(Yast::Package).to receive(:DoInstall).with(feature_pkg[1..]) subject.install(ask: false) end @@ -125,7 +125,7 @@ # Let's simulate the first package is already installed allow(Yast::Package).to receive(:Installed).with(feature_pkg[0]).and_return true - expect(Yast::Package).to receive(:CheckAndInstallPackages).with(feature_pkg[1..-1]) + expect(Yast::Package).to receive(:CheckAndInstallPackages).with(feature_pkg[1..]) subject.install end diff --git a/test/y2storage/secret_attributes_test.rb b/test/y2storage/secret_attributes_test.rb index 6a612144e0..ac38732b4f 100755 --- a/test/y2storage/secret_attributes_test.rb +++ b/test/y2storage/secret_attributes_test.rb @@ -20,7 +20,6 @@ require_relative "spec_helper" require "y2storage" -require "pp" require "y2storage/equal_by_instance_variables" describe Y2Storage::SecretAttributes do diff --git a/test/y2storage/storage_class_wrapper_test.rb b/test/y2storage/storage_class_wrapper_test.rb index 06b6d16d76..b140c016ad 100755 --- a/test/y2storage/storage_class_wrapper_test.rb +++ b/test/y2storage/storage_class_wrapper_test.rb @@ -29,7 +29,7 @@ describe wrapper do all_children = ObjectSpace.each_object(Class).select { |c| c < wrapper } direct_children = all_children.select do |child| - ancestors_classes = child.ancestors[1..-1].select { |c| c.is_a?(Class) } + ancestors_classes = child.ancestors[1..].select { |c| c.is_a?(Class) } ancestors_classes.first == wrapper end