Sha256: 32425ca2533491e7927491f0f6e9a5144c8cfd654c1526762f9d7b7abb1afd86
Contents?: true
Size: 1.85 KB
Versions: 1
Compression:
Stored size: 1.85 KB
Contents
require 'spec_helper' describe Libvirt::Ruby do let(:libvirt) { Libvirt::Ruby } let(:p) { Object } context "#initialize" do before :each do libvirt.stub(:virInitialize).with(:int).and_return(true) libvirt.stub(:virInitialize).and_return(true) end after :each do libvirt.initialize end context "when virInitialize is not attached yet" do it "should attach it" do libvirt.should_receive(:virInitialize).with(:int) end end context "when virInitialize is already attached" do before :each do libvirt.stub(:respond_to_missing?).with(:virInitialize, false).and_return(true) end it "should not try to attach it again" do libvirt.should_not_receive(:virInitialize).with(:int) end end it "should call virInitialize" do libvirt.should_receive(:virInitialize) end end context "#version" do before :each do libvirt.stub(:virGetVersion).with(:pointer, :string, :pointer, :int).and_return(true) FFI::MemoryPointer.stub(:new).with(:ulong).and_return(p) libvirt.stub(:virGetVersion).with(p, nil, nil).and_return(true) p.stub(:get_ulong).with(0).and_return(8003) end context "when virGetVersion is not attached yet" do it "should attach it" do libvirt.should_receive(:virGetVersion).with(:pointer, :string, :pointer, :int) libvirt.version end end context "when virGetVersion is already attached" do before :each do libvirt.stub(:respond_to_missing?).with(:virGetVersion, false).and_return(true) end it "should not try to attach it again" do libvirt.should_not_receive(:virGetVersion).with(:pointer, :string, :pointer, :int) libvirt.version end end it "should return the version" do libvirt.version.should == "0.8.3" 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_spec.rb |