Skip to content

Commit

Permalink
Add missing test examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dgdavid committed Apr 23, 2020
1 parent 51d67e0 commit 02f022b
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 3 deletions.
48 changes: 48 additions & 0 deletions test/lib/widgets/storage/add_children_button_test.rb
@@ -0,0 +1,48 @@
# Copyright (c) [2020] SUSE LLC
#
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, contact SUSE LLC.
#
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.

require_relative "../../../test_helper"
require "autoinstall/widgets/storage/add_children_button"
require "autoinstall/storage_controller"
require "cwm/rspec"

describe Y2Autoinstallation::Widgets::Storage::AddChildrenButton do
subject(:widget) { described_class.new(controller, section) }

include_examples "CWM::PushButton"

let(:controller) { Y2Autoinstallation::StorageController.new(partitioning) }
let(:partitioning) do
Y2Storage::AutoinstProfile::PartitioningSection.new_from_hashes([])
end
let(:section) do
Y2Storage::AutoinstProfile::DriveSection.new_from_hashes(
type: :CT_DISK,
filesystem: :btrfs,
mount: "/home"
)
end

describe "#handle" do
it "add new partition section" do
expect(controller).to receive(:add_partition).with(section)
widget.handle
end
end
end
2 changes: 1 addition & 1 deletion test/lib/widgets/storage/add_drive_button_test.rb
Expand Up @@ -41,7 +41,7 @@
end
end

context "adding a disk" do
context "adding a RAID" do
let(:event) do
{ "ID" => :add_raid }
end
Expand Down
2 changes: 2 additions & 0 deletions test/lib/widgets/storage/disk_page_test.rb
Expand Up @@ -26,6 +26,8 @@
describe Y2Autoinstallation::Widgets::Storage::DiskPage do
subject { described_class.new(controller, drive) }

include_examples "CWM::Page"

let(:partitioning) do
Y2Storage::AutoinstProfile::PartitioningSection.new_from_hashes(
[{ "type" => :CT_DISK }]
Expand Down
2 changes: 2 additions & 0 deletions test/lib/widgets/storage/overview_tree_pager_test.rb
Expand Up @@ -25,6 +25,8 @@
describe Y2Autoinstallation::Widgets::Storage::OverviewTreePager do
subject { described_class.new(controller) }

include_examples "CWM::Pager"

let(:partitioning) { Y2Storage::AutoinstProfile::PartitioningSection.new_from_hashes(attrs) }
let(:attrs) do
[{ "device" => "/dev/sda", "partitions" => [{ "mount" => "/" }] },
Expand Down
4 changes: 2 additions & 2 deletions test/lib/widgets/storage/partition_page_test.rb
Expand Up @@ -26,6 +26,8 @@
describe Y2Autoinstallation::Widgets::Storage::PartitionPage do
subject { described_class.new(controller, drive, partition) }

include_examples "CWM::Page"

let(:partitioning) do
Y2Storage::AutoinstProfile::PartitioningSection.new_from_hashes(
[{ "type" => :CT_DISK, "partitions" => [partition_hash] }]
Expand All @@ -36,8 +38,6 @@
let(:controller) { Y2Autoinstallation::StorageController.new(partitioning) }
let(:partition_hash) { {} }

include_examples "CWM::Page"

describe "#label" do
context "when the partition is used as a filesystem" do
context "when the partition mount point is defined" do
Expand Down
2 changes: 2 additions & 0 deletions test/lib/widgets/storage/raid_page_test.rb
Expand Up @@ -26,6 +26,8 @@
describe Y2Autoinstallation::Widgets::Storage::RaidPage do
subject { described_class.new(controller, drive) }

include_examples "CWM::Page"

let(:partitioning) do
Y2Storage::AutoinstProfile::PartitioningSection.new_from_hashes(
[{ "device" => "/dev/md0", "type" => :CT_RAID }]
Expand Down

0 comments on commit 02f022b

Please sign in to comment.