Sha256: 69902351d9b178d631d953947aa359ef9a6f33b1ffe5fcbbf18b6491ef5e4f8f
Contents?: true
Size: 1.55 KB
Versions: 12
Compression:
Stored size: 1.55 KB
Contents
#! /usr/bin/env ruby require 'spec_helper' require 'ostruct' require 'puppet/util/network_device' describe Puppet::Util::NetworkDevice do before(:each) do @device = OpenStruct.new(:name => "name", :provider => "test", :url => "telnet://admin:password@127.0.0.1", :options => { :debug => false }) end after(:each) do Puppet::Util::NetworkDevice.teardown end class Puppet::Util::NetworkDevice::Test class Device def initialize(device, options) end end end describe "when initializing the remote network device singleton" do it "should load the network device code" do Puppet::Util::NetworkDevice.expects(:require) Puppet::Util::NetworkDevice.init(@device) end it "should create a network device instance" do Puppet::Util::NetworkDevice.stubs(:require) Puppet::Util::NetworkDevice::Test::Device.expects(:new).with("telnet://admin:password@127.0.0.1", :debug => false) Puppet::Util::NetworkDevice.init(@device) end it "should raise an error if the remote device instance can't be created" do Puppet::Util::NetworkDevice.stubs(:require).raises("error") expect { Puppet::Util::NetworkDevice.init(@device) }.to raise_error end it "should let caller to access the singleton device" do device = stub 'device' Puppet::Util::NetworkDevice.stubs(:require) Puppet::Util::NetworkDevice::Test::Device.expects(:new).returns(device) Puppet::Util::NetworkDevice.init(@device) expect(Puppet::Util::NetworkDevice.current).to eq(device) end end end
Version data entries
12 entries across 12 versions & 1 rubygems