[Rspec-devel] habtm collections

David Chelimsky dchelimsky at gmail.com
Sun Aug 27 10:25:55 EDT 2006


Looks like another sugary sweetness problem - a conflict between
rspec's use of method_missing and that of active_record:


TypeError in 'Animal should have person'
wrong argument type Animal (expected Module)
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:1129:in
`method_missing'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/associations/has_many_association.rb:102:in
`method_missing'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:873:in
`with_scope'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/associations/has_many_association.rb:92:in
`method_missing'

I've raised issue #5539 at rubyforge:


On 8/20/06, David Astels <dastels at daveastels.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> It looks like we need better support for habtm virtual collections...
> at least based on the behaviour I'm seeing.
>
> For example, instead of doing:
>
>         @dave.tracks.should_include Track.find_by_name("School's Out")
>
> I have to do:
>
>         @dave.tracks.include?(Track.find_by_name("School's Out")).should_be
> true
>
> Yuck.
>
> Dave
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.3 (Darwin)
>
> iD8DBQFE6OvBauez/L4x7g4RAlGaAKCUjKFYUlRuu8KoRxedgPMtFtXwXQCfRZ7x
> 1vgNY50aZK+phkDhAEUXVnk=
> =29QJ
> -----END PGP SIGNATURE-----
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>


More information about the Rspec-devel mailing list