I'm pretty sure this would be ok - that method is called for each resource created, so your stub should work fine.
On Dec 17, 2009, at 2:28 PM, Jesse A Wolfe wrote: > +1. I'm still a little worried about what could happen if the wrong > provider leaked in from another test, but I'm resigned to say that > that's outside the scope of this fix. > > On Thu, Dec 17, 2009 at 11:47 AM, Markus Roberts > <[email protected]> wrote: > The problem was that the setup for the tests was expecting the > defaultprovider > for Selboolean and Selmodule to be called, rather than stubbing it. > This > worked as long as no other spec which initializes the providers was > run before > it. > > The fix here (stubbing rather than expecting) is minimal but not > ideal; if > there were some other provider for these types it could result in a > test > indetermenacy (different results depending on which provider) but > I'm not > seeing an easy way to address that. > > Signed-off-by: Markus Roberts <[email protected]> > --- > spec/unit/other/selinux.rb | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/spec/unit/other/selinux.rb b/spec/unit/other/selinux.rb > index 3e39afc..2287570 100644 > --- a/spec/unit/other/selinux.rb > +++ b/spec/unit/other/selinux.rb > @@ -28,7 +28,7 @@ end > describe Puppet::Type.type(:selboolean), " when manipulating > booleans" do > before :each do > provider_class = > Puppet > ::Type::Selboolean.provider(Puppet::Type::Selboolean.providers[0]) > - Puppet::Type::Selboolean.expects(:defaultprovider).returns > provider_class > + Puppet::Type::Selboolean.stubs(:defaultprovider).returns > provider_class > > @bool = Puppet::Type::Selboolean.new( > :name => "foo", > @@ -57,7 +57,7 @@ end > describe Puppet::Type.type(:selmodule), " when checking policy > modules" do > before :each do > provider_class = > Puppet::Type::Selmodule.provider(Puppet::Type::Selmodule.providers[0]) > - Puppet::Type::Selmodule.expects(:defaultprovider).returns > provider_class > + Puppet::Type::Selmodule.stubs(:defaultprovider).returns > provider_class > > @module = Puppet::Type::Selmodule.new( > :name => "foo", > -- > 1.6.4 > > -- > > You received this message because you are subscribed to the Google > Groups "Puppet Developers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected] > . > For more options, visit this group at > http://groups.google.com/group/puppet-dev?hl=en > . > > > > > -- > > You received this message because you are subscribed to the Google > Groups "Puppet Developers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected] > . > For more options, visit this group at > http://groups.google.com/group/puppet-dev?hl=en > . -- It's not that I'm afraid to die. I just don't want to be there when it happens. -- Woody Allen --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
