spec/rpm_spec.rb in linux_admin-0.14.0 vs spec/rpm_spec.rb in linux_admin-0.15.0

- old
+ new

@@ -1,8 +1,9 @@ describe LinuxAdmin::Rpm do it ".list_installed" do - allow(described_class).to receive_messages(:run! => double(:output => sample_output("rpm/cmd_output_for_list_installed"))) + allow(LinuxAdmin::Common).to receive(:run!) + .and_return(double(:output => sample_output("rpm/cmd_output_for_list_installed"))) expect(described_class.list_installed).to eq({ "ruby193-rubygem-some_really_long_name" =>"1.0.7-1.el6", "fipscheck-lib" =>"1.2.0-7.el6", "aic94xx-firmware" =>"30-2.el6", "latencytop-common" =>"0.5-9.el6", @@ -24,11 +25,11 @@ "zlib-devel" =>"1.2.3-29.el6", }) end it ".import_key" do - expect(described_class).to receive(:run!).with("rpm", {:params => {"--import" => "abc"}}) + expect(LinuxAdmin::Common).to receive(:run!).with("rpm", :params => {"--import" => "abc"}) expect { described_class.import_key("abc") }.to_not raise_error end describe "#info" do it "returns package metadata" do @@ -57,11 +58,11 @@ files and to do system management tasks (as in Perl). It is simple, straight-forward, and extensible. EOS arguments = [described_class.rpm_cmd, :params => {"-qi" => "ruby"}] result = AwesomeSpawn::CommandResult.new("", data, "", 0) - expect(described_class).to receive(:run!).with(*arguments).and_return(result) + expect(LinuxAdmin::Common).to receive(:run!).with(*arguments).and_return(result) metadata = described_class.info("ruby") expect(metadata['name']).to eq('ruby') expect(metadata['version']).to eq('2.0.0.247') expect(metadata['release']).to eq('15.fc19') expect(metadata['architecture']).to eq('x86_64') @@ -75,9 +76,10 @@ expect(metadata['summary']).to eq('An interpreter of object-oriented scripting language') end end it ".upgrade" do - expect(described_class).to receive(:run).with("rpm -U", {:params=>{nil=>"abc"}}).and_return(double(:exit_status => 0)) + expect(LinuxAdmin::Common).to receive(:run).with("rpm -U", :params => {nil => "abc"}) + .and_return(double(:exit_status => 0)) expect(described_class.upgrade("abc")).to be_truthy end end