Sha256: 3f5e546227740580ba03279492bc8494249a46d6607b4e1082164db7a97c27ec
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 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 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_missing?).with(:virConnectOpenReadOnly, false).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.0 | spec/libvirt-ruby-mapping/connect/open_read_only_spec.rb |