Sha256: d23ff4f190439ad8100dd68eea3e6cfd3d1f4d151107935934eed6fdb3229cc1
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
require 'spec_helper' describe Libvirt::Ruby::Connect do let(:connect) { Libvirt::Ruby::Connect } let(:p) { Object } context "#open_read_only" do before :each do connect.stub(:virConnectOpenReadOnly).with(:string, :pointer).and_return(true) connect.stub(:virConnectOpenReadOnly).with("uri").and_return(p) end after :each do connect.open_read_only("uri") end context "when virConnectOpenReadOnly is not attached yet" do before :each do connect.stub(:respond_to?).with(:virConnectOpenReadOnly).and_return(false) end it "should attach it" do connect.should_receive(:virConnectOpenReadOnly).with(:string, :pointer) end end context "when virConnectOpenReadOnly is already attached" do before :each do connect.stub(:respond_to?).with(:virConnectOpenReadOnly).and_return(true) end it "should not try to attach it again" do connect.should_not_receive(:virConnectOpenReadOnly).with(:string, :pointer) end end it "should call virConnectOpenReadOnly" do connect.should_receive(:virConnectOpenReadOnly) end it "should return the pointer to the new read only connection" do connect.open_read_only("uri").should == p end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
libvirt-ruby-mapping-0.1.1 | spec/libvirt-ruby-mapping/connect/open_read_only_spec.rb |