Skip to content
This repository has been archived by the owner on Nov 29, 2017. It is now read-only.

Commit

Permalink
maint: Fix order-dependent spec failures
Browse files Browse the repository at this point in the history
The specs for InterfaceCollection were clearing the list of interfaces at the
end of the spec run, which caused later specs to fail because they couldn't
re-require interfaces they needed. This fixes the InterfaceCollection specs to
save and restore the interfaces at the end of the file.

Reviewed-By: Matt Robinson
  • Loading branch information
nicklewis committed Mar 23, 2011
1 parent f7db675 commit af79d3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 4 additions & 5 deletions spec/unit/application/interface_base_spec.rb
Expand Up @@ -2,13 +2,12 @@

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
require 'puppet/application/interface_base'
require 'puppet/application/interface_base'

base_interface = Puppet::Interface.interface(:basetest)
class Puppet::Application::InterfaceBase::Basetest < Puppet::Application::InterfaceBase
end

describe Puppet::Application::InterfaceBase do
base_interface = Puppet::Interface.interface(:basetest)
class Puppet::Application::InterfaceBase::Basetest < Puppet::Application::InterfaceBase
end

before do
@app = Puppet::Application::InterfaceBase::Basetest.new
@app.stubs(:interface).returns base_interface
Expand Down
8 changes: 7 additions & 1 deletion spec/unit/interface/interface_collection_spec.rb
Expand Up @@ -3,12 +3,18 @@
require 'puppet/interface/interface_collection'

describe Puppet::Interface::InterfaceCollection do
# This is global state that other tests depend on, so we have to save and
# restore it
before :all do
@saved_interfaces = subject.instance_variable_get("@interfaces").dup
end

before :each do
subject.instance_variable_set("@interfaces", {})
end

after :all do
subject.instance_variable_set("@interfaces", {})
subject.instance_variable_set("@interfaces", @saved_interfaces)
end

describe "::interfaces" do
Expand Down

0 comments on commit af79d3c

Please sign in to comment.