[rspec-users] Variance in behaviour: rake features vs. autotest

James Byrne lists at ruby-forum.com
Fri Nov 28 10:38:54 EST 2008

Andrew Premdas wrote:
> Bit of a guess but
> def build_valid_entities(n=1)
>  Entity.transaction do
>    Entity.destroy_all
>    n.to_i.times do |x|
>      Entity.create!  :entity_name => "Entity #{x}",
>        :entity_legal_name => "Entity #{n} Legal Name",
>        :entity_legal_form => "CORP"
>    end
>  end
> end
> Note the x inside the blcok. Probably not a good idea to use same
> variable inside and outside block
> 2008/11/27 James Byrne <lists at ruby-forum.com>:

True, true. Although in this case the value assigned to 
:entity_legal_name was meaningless in other circumstances this could 
have been a subtle error to find if the test data was expected to be 
unique.  As I discovered and have reported, my residual discrepancies in 
autotest results was due to the loading of TestUnit fixtures leaving the 
database in a populated state.  Altering the tests to allow for 
pre-existing entries resolved the difference in observed behaviour.

As for my custom notifier for autotest, the reason that this does not 
work is that cucumber does not link its results to the :red, :green, 
:all_good hooks of autotest.  I have opened a ticket for a feature 
request to have this functionality added to cucumber.

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list