Max Williams
2008-Feb-27 12:12 UTC
[rspec-users] has_many_polymorphs is breaking my testing
I have a class Property that was testing fine until i added the following to
it:
has_many_polymorphs :labelled,
:from => [:instructional_objects, :lessons, :courses],
:through => :labels,
:dependent => :destroy
(in other words, ''labels'' is a join table through which
various objects can
be labelled with a property)
Now my spec file crashes, saying that Property isn''t defined in
property.rb:
does anyone know what''s gone wrong here?
/home/jars/rails/lesson_planner/branches/max/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:249:in
`load_missing_constant'': Expected
/home/jars/rails/lesson_planner/branches/max/app/models/property.rb to
define Property (LoadError)
from
/home/jars/rails/lesson_planner/branches/max/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:452:in
`const_missing''
from
/home/jars/rails/lesson_planner/branches/max/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:464:in
`const_missing''
from ./spec/models/property_spec.rb:3
...
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/rspec-users/attachments/20080227/01ae53a0/attachment.html
Max Williams
2008-Feb-27 13:14 UTC
[rspec-users] has_many_polymorphs is breaking my testing
Never mind, i''m an idiot, the problem was that i broke my Property class with the has_many_polymorphs declaration, so the spec couldn''t load it. Sorry! On 27/02/2008, Max Williams <toastkid.williams at gmail.com> wrote:> > I have a class Property that was testing fine until i added the following > to it: > > has_many_polymorphs :labelled, > :from => [:instructional_objects, :lessons, :courses], > :through => :labels, > :dependent => :destroy > > (in other words, ''labels'' is a join table through which various objects > can be labelled with a property) > > Now my spec file crashes, saying that Property isn''t defined in > property.rb: does anyone know what''s gone wrong here? > > /home/jars/rails/lesson_planner/branches/max/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:249:in > `load_missing_constant'': Expected > /home/jars/rails/lesson_planner/branches/max/app/models/property.rb to > define Property (LoadError) > from > /home/jars/rails/lesson_planner/branches/max/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:452:in > `const_missing'' > from > /home/jars/rails/lesson_planner/branches/max/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:464:in > `const_missing'' > from ./spec/models/property_spec.rb:3 > ... >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080227/ce0fee39/attachment-0001.html