Skip to content

Commit 04576a1

Browse files
committed
Add relevant tests
1 parent e1c93fd commit 04576a1

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

spec/unit/puppet/provider/volume_group/lvm_spec.rb

+18-5
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,24 @@
2828
end
2929

3030
describe 'when creating' do
31-
it "executes 'vgcreate'" do
32-
@resource.expects(:[]).with(:name).returns('myvg')
33-
@resource.expects(:should).with(:physical_volumes).returns(['/dev/hda'])
34-
@provider.expects(:vgcreate).with('myvg', '/dev/hda')
35-
@provider.create
31+
context 'when an extent size is not provided' do
32+
it "executes 'vgcreate'" do
33+
@resource.expects(:[]).with(:name).returns('myvg')
34+
@resource.expects(:[]).with(:extent_size).returns(nil)
35+
@resource.expects(:should).with(:physical_volumes).returns(['/dev/hda'])
36+
@provider.expects(:vgcreate).with('myvg', '/dev/hda')
37+
@provider.create
38+
end
39+
end
40+
41+
context 'when an extent size is provided' do
42+
it "executes 'vgcreate' with the desired extent size" do
43+
@resource.expects(:[]).with(:name).returns('myvg')
44+
@resource.expects(:[]).twice.with(:extent_size).returns('16M')
45+
@resource.expects(:should).with(:physical_volumes).returns(['/dev/hda'])
46+
@provider.expects(:vgcreate).with('myvg', '/dev/hda', '-s', '16M')
47+
@provider.create
48+
end
3649
end
3750
end
3851

spec/unit/puppet/type/volume_group_spec.rb

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
end
1919
end
2020

21+
describe 'the extent_size parameter' do
22+
it 'exists' do
23+
@type.attrclass(:extent_size).should_not be_nil
24+
end
25+
end
26+
2127
describe "the 'ensure' parameter" do
2228
it 'exists' do
2329
@type.attrclass(:ensure).should_not be_nil

0 commit comments

Comments
 (0)