S --

I'm currrently looking at the specs for the ssh_authorized_key provider.
>> There are two tests that give me a headache:
>>
>>    it "should create the directory if it doesn't exist" do
>>      File.stubs(:exist?).with(@dir).returns false
>>      Dir.expects(:mkdir).with(@dir,0700)
>>      @provider.flush
>>    end
>>
>>    it "should not create or chown the directory if it already exist" do
>>      File.stubs(:exist?).with(@dir).returns false
>>      Dir.expects(:mkdir).never
>>      @provider.flush
>>    end
>>
>> Both tests stub exist? to return false (which is obviously wrong in the
>> second case) but both tests are expecting different results. Nevertheless
>> both tests will pass. Am I overlooking something? How can this happen?
>>
>
> Wow.  I'll deffer to Luke on the "what to do about it" issue but apart from
> that this look like another rspec bug (along the lines of the
> be_any/all/none... bug, http://www.ruby-forum.com/topic/197643) but I'm
> not seeing the mechanism off the top of my head.
>
> It's probably worth figuring out if only to identify other tests that might
> not be doing what they look like,
>

It looks like 1) the tests are stubbing Dir.mkdir and 2) expects are
silently ignored on stubs so 3) the problematic lines simply aren't doing
what they look like.

-- M
-----------------------------------------------------------
When in trouble or in doubt, run in circles,
scream and shout. -- 1920's parody of the
maritime general prudential rule
------------------------------------------------------------

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to