summaryrefslogtreecommitdiffstats
path: root/spec/unit/provider/interface
diff options
context:
space:
mode:
authorPieter van de Bruggen <pieter@puppetlabs.com>2011-04-18 13:40:31 -0700
committerPieter van de Bruggen <pieter@puppetlabs.com>2011-04-18 14:08:32 -0700
commit07b677c5f6af8def03c5c30393fd83bc3986239a (patch)
treeb28d3376b4ea835a2348ebfea898d674cb593e34 /spec/unit/provider/interface
parentb142973a94ced6c0ff43da882189abe806c18c68 (diff)
downloadpuppet-07b677c5f6af8def03c5c30393fd83bc3986239a.tar.gz
puppet-07b677c5f6af8def03c5c30393fd83bc3986239a.tar.xz
puppet-07b677c5f6af8def03c5c30393fd83bc3986239a.zip
Merge remote-tracking branch 'community/feature/puppet-device' into 2.7.x
Reviewed-By: Mike Stahnke
Diffstat (limited to 'spec/unit/provider/interface')
-rwxr-xr-xspec/unit/provider/interface/cisco_spec.rb20
1 files changed, 7 insertions, 13 deletions
diff --git a/spec/unit/provider/interface/cisco_spec.rb b/spec/unit/provider/interface/cisco_spec.rb
index d1f70609f..c18f87cf8 100755
--- a/spec/unit/provider/interface/cisco_spec.rb
+++ b/spec/unit/provider/interface/cisco_spec.rb
@@ -8,12 +8,13 @@ provider_class = Puppet::Type.type(:interface).provider(:cisco)
describe provider_class do
before do
+ @device = stub_everything 'device'
@resource = stub("resource", :name => "Fa0/1")
- @provider = provider_class.new(@resource)
+ @provider = provider_class.new(@device, @resource)
end
- it "should have a parent of Puppet::Provider::NetworkDevice" do
- provider_class.should < Puppet::Provider::NetworkDevice
+ it "should have a parent of Puppet::Provider::Cisco" do
+ provider_class.should < Puppet::Provider::Cisco
end
it "should have an instances method" do
@@ -22,31 +23,24 @@ describe provider_class do
describe "when looking up instances at prefetch" do
before do
- @device = stub_everything 'device'
- Puppet::Util::NetworkDevice::Cisco::Device.stubs(:new).returns(@device)
@device.stubs(:command).yields(@device)
end
- it "should initialize the network device with the given url" do
- Puppet::Util::NetworkDevice::Cisco::Device.expects(:new).with(:url).returns(@device)
- provider_class.lookup(:url, "Fa0/1")
- end
-
it "should delegate to the device interface fetcher" do
@device.expects(:interface)
- provider_class.lookup("", "Fa0/1")
+ provider_class.lookup(@device, "Fa0/1")
end
it "should return the given interface data" do
@device.expects(:interface).returns({ :description => "thisone", :mode => :access})
- provider_class.lookup("", "Fa0").should == {:description => "thisone", :mode => :access }
+ provider_class.lookup(@device, "Fa0").should == {:description => "thisone", :mode => :access }
end
end
describe "when an instance is being flushed" do
it "should call the device interface update method with current and past properties" do
- @instance = provider_class.new(:ensure => :present, :name => "Fa0/1", :description => "myinterface")
+ @instance = provider_class.new(@device, :ensure => :present, :name => "Fa0/1", :description => "myinterface")
@instance.description = "newdesc"
@instance.resource = @resource
@resource.stubs(:[]).with(:name).returns("Fa0/1")