@Pat: thanks for the suggestions.
It's perhaps not only what David suggested -- I seem to be suffering
from some cached AR value. I changed my constant declaration to:
RESIDENTIAL = find_or_create_by_name("residential")
This keeps the number of instances down to a 1. That's good. But if I
SOLVED -- it was an AR caching problem. I had Factory code that was
essentially doing:
def make_me_a_premise(opts = {})
opts = MODEL_PREMISE_DEFAULTS.merge(opts)
premise = Factory(:premise)
Factory(:premise_group_member,
:premise => premise,
:premise_group =>
On Feb 24, 2011, at 12:58 PM, Fearless Fool wrote:
> David Chelimsky wrote in post #983690:
>>> RESIDENTIAL = self.create(:name => "residential")
>> ^^ this is probably the problem ^^
>> ...
>
> Ah! got it. FWIW, I wrote a query to the Rails group several months
> ago wondering if this cons
David Chelimsky wrote in post #983690:
>>RESIDENTIAL = self.create(:name => "residential")
> ^^ this is probably the problem ^^
> ...
Ah! got it. FWIW, I wrote a query to the Rails group several months
ago wondering if this construct was legit and got feedback that it was
legit. Your expl
yet more info...
The two errors appear to be closely related. When run as individual
files,
PremiseGroup#premises
is returning expected values. When run together, premise_group.premises
returns "phantom" premises (which show up as nil values). For test B,
the phantoms causes the count to b
cattr_accessor, class vars / class instance vars, constants, globals...all
things that maintain state across test runs, and so could lead to errors like
this. I'd start looking there.
Pat
On Feb 24, 2011, at 9:55 AM, Fearless Fool wrote:
> I'm baffled. If I do:
>
> $ bundle exec ruby -S r
David Chelimsky wrote in post #983675:
> On Feb 24, 2011, at 11:55 AM, Fearless Fool wrote:
> What are the failures you're seeing?
When running A before B, B's assertion that:
@common_options[:premise_group].premises.size.should == 3
fails because premise_group.premises.size == 5 (even though on
On Feb 24, 2011, at 12:36 PM, Fearless Fool wrote:
> A little additional information: every time I run the tests, it creates
> a new PremiseGroup model. Shouldn't the db get rolled back between
> tests?
>
> Here is PremiseGroup, listed here in its entirety:
>
> class PremiseGroup < ActiveRec
A little additional information: every time I run the tests, it creates
a new PremiseGroup model. Shouldn't the db get rolled back between
tests?
Here is PremiseGroup, listed here in its entirety:
class PremiseGroup < ActiveRecord::Base
has_many :premise_group_members, :dependent => :des
On Feb 24, 2011, at 11:55 AM, Fearless Fool wrote:
> I'm baffled. If I do:
>
> $ bundle exec ruby -S rspec --tty A_spec.rb
> $ bundle exec ruby -S rspec --tty B_spec.rb
>
> I get no errors. But then if I do:
>
> $ bundle exec ruby -S rspec --tty A_spec.rb B_spec.rb
>
> I get an error o
I'm baffled. If I do:
$ bundle exec ruby -S rspec --tty A_spec.rb
$ bundle exec ruby -S rspec --tty B_spec.rb
I get no errors. But then if I do:
$ bundle exec ruby -S rspec --tty A_spec.rb B_spec.rb
I get an error on B_spec. And if I reverse the order:
$ bundle exec ruby -S rspe
11 matches
Mail list logo