spec/unit/plugins/linux/platform_spec.rb in ohai-6.16.0 vs spec/unit/plugins/linux/platform_spec.rb in ohai-6.18.0.rc.0

- old
+ new

@@ -70,10 +70,16 @@ @ohai[:lsb][:id] = "LinuxMint" @ohai._require_plugin("linux::platform") @ohai[:platform].should == "linuxmint" @ohai[:platform_family].should == "debian" end + it "should set platform to gcel and platform_family to debian [:lsb][:id] contains GCEL" do + @ohai[:lsb][:id] = "GCEL" + @ohai._require_plugin("linux::platform") + @ohai[:platform].should == "gcel" + @ohai[:platform_family].should == "debian" + end it "should set platform to debian and platform_family to debian [:lsb][:id] contains Debian" do @ohai[:lsb][:id] = "Debian" @ohai._require_plugin("linux::platform") @ohai[:platform].should == "debian" @ohai[:platform_family].should == "debian" @@ -376,16 +382,15 @@ describe "with lsb_release results" do before(:each) do @ohai[:lsb][:id] = "SUSE LINUX" end - it "should read the platform as suse" do + it "should read the platform as opensuse on openSUSE" do @ohai[:lsb][:release] = "12.1" - File.should_receive(:read).with("/etc/SuSE-release").exactly(2).times.and_return("openSUSE 12.1 (x86_64)\nVERSION = 12.1\nCODENAME = Asparagus\n") + File.should_receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.1 (x86_64)\nVERSION = 12.1\nCODENAME = Asparagus\n") @ohai._require_plugin("linux::platform") - @ohai[:platform].should == "suse" - @ohai[:platform_version].should == "12.1" + @ohai[:platform].should == "opensuse" @ohai[:platform_family].should == "suse" end end describe "without lsb_release results" do @@ -419,29 +424,33 @@ @ohai[:platform_version].should == "11.2" @ohai[:platform_family].should == "suse" end it "[OHAI-272] should read the version as 11.3" do - File.should_receive(:read).with("/etc/SuSE-release").exactly(2).times.and_return("openSUSE 11.3 (x86_64)\nVERSION = 11.3") + File.should_receive(:read).with("/etc/SuSE-release").and_return("openSUSE 11.3 (x86_64)\nVERSION = 11.3") @ohai._require_plugin("linux::platform") - @ohai[:platform].should == "suse" @ohai[:platform_version].should == "11.3" @ohai[:platform_family].should == "suse" end it "[OHAI-272] should read the version as 9.1" do - File.should_receive(:read).with("/etc/SuSE-release").exactly(2).times.and_return("SuSE Linux 9.1 (i586)\nVERSION = 9.1") + File.should_receive(:read).with("/etc/SuSE-release").and_return("SuSE Linux 9.1 (i586)\nVERSION = 9.1") @ohai._require_plugin("linux::platform") - @ohai[:platform].should == "suse" @ohai[:platform_version].should == "9.1" @ohai[:platform_family].should == "suse" end it "[OHAI-272] should read the version as 11.4" do - File.should_receive(:read).with("/etc/SuSE-release").exactly(2).times.and_return("openSUSE 11.4 (i586)\nVERSION = 11.4\nCODENAME = Celadon") + File.should_receive(:read).with("/etc/SuSE-release").and_return("openSUSE 11.4 (i586)\nVERSION = 11.4\nCODENAME = Celadon") @ohai._require_plugin("linux::platform") - @ohai[:platform].should == "suse" @ohai[:platform_version].should == "11.4" + @ohai[:platform_family].should == "suse" + end + + it "should read the platform as opensuse on openSUSE" do + File.should_receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.2 (x86_64)\nVERSION = 12.2\nCODENAME = Mantis\n") + @ohai._require_plugin("linux::platform") + @ohai[:platform].should == "opensuse" @ohai[:platform_family].should == "suse" end end end