Skip to content

Commit

Permalink
Merge 51247dc into 210f924
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed Apr 27, 2017
2 parents 210f924 + 51247dc commit c19d077
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/device_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,37 @@
expect(device.siblings).to all(be_a(Y2Storage::Partition))
end
end

describe "#detect_resize_info" do
let(:probed) { double(Y2Storage::Devicegraph) }
let(:probed_partition) { double(Y2Storage::Partition, storage_detect_resize_info: resize_info) }
let(:resize_info) { double(Y2Storage::ResizeInfo) }
let(:wrapped_partition) { double(Storage::Partition, exists_in_probed?: in_probed, sid: 444) }

subject(:staging_partition) { Y2Storage::Partition.new(wrapped_partition) }

before do
allow(Storage).to receive(:to_partition) do |object|
object
end
allow(Y2Storage::StorageManager.instance).to receive(:y2storage_probed).and_return probed
end

context "if the device does not exist in probed" do
let(:in_probed) { false }

it "returns nil" do
expect(staging_partition.detect_resize_info).to be_nil
end
end

context "if the device exists in probed" do
let(:in_probed) { true }

it "returns the resize info from the equivalent partition in probed" do
expect(probed).to receive(:find_device).with(444).and_return probed_partition
expect(staging_partition.detect_resize_info).to eq resize_info
end
end
end
end

0 comments on commit c19d077

Please sign in to comment.