[rspec-users] problem to mock association proxy

Ashley Moran ashley.moran at patchspace.co.uk
Fri Dec 5 15:41:31 EST 2008

On 5 Dec 2008, at 20:26, Daniel Area Criações wrote:

> This line is only saying that @properties (assigned[:properties])  
> have some value ... is that?
> assigns[:properties].should == :user_properties
> I can change above to assigns[:properties].should_not be_nill and  
> the semantic value will be the same, right?

Ah no, the semantic value is different because this would also pass:

   def index
     @properties = "vegetable soup"

Yet that does not implement the same behaviour.

When you write a behaviour example, always ask the question "What  
could I realistically write that could pass this but not give the  
desired behaviour?"  That way you will avoid false confidence in specs  
where the behaviour could be broken in the future (perhaps during  
refactoring), but RSpec still reports success.



More information about the rspec-users mailing list