zeisler / active_mocker

Generate mocks from ActiveRecord models for unit tests that run fast because they don’t need to load Rails or a database.
http://dustinzeisler.com/active_mocker/
MIT License
506 stars 29 forks source link

Support polymorphic associations #46

Open markburns opened 8 years ago

markburns commented 8 years ago

Usage of polymorphic associations results in an exception

e.g.

Missing model Bar for association Foo.belongs_to :bar, polymorphic: true
zeisler commented 8 years ago

This is known limitation of active_mocker. To add this feature it would take adjustments in the generation code as well the in-memory query engine. If you like assist with the process what would make things move faster would a PR with all the needed models and a failing testing in active_record_compatible_api.rb

RepoCorp commented 6 years ago

I'm also trying to use a polymorphic association but the error I'm getting is

Polymorphic association does not support to compute class.

Is the polymorphic associations features already implemented? What does this error means and is there a way to solve it?

zeisler commented 6 years ago

@RepoCorp Can you provide more context? I don't believe that error is coming from this gem. Given that, work has not been done to officially support polymorphic associations, but in some cases it might work.