active_mocker
active_mocker copied to clipboard
Generate mocks from ActiveRecord models for unit tests that run fast because they don’t need to load Rails or a database.
Usage of polymorphic associations results in an exception e.g. ``` Missing model Bar for association Foo.belongs_to :bar, polymorphic: true ```
```ruby has_many :decision_mortgages has_many :credit_liabilities, through: :decision_mortgages ``` ActiveMocker treats credit_liabilities as an association on the parent model and ignores the `through`. The work around is ```ruby Model.new(credit_liabilities: credit_liabilities) ```...
Sample output ``` bash Generating Mocks |========================================================>>| 100% Error Summary errors: 1, warn: 5, info: 0 Failed models: ReportParser::UnderwritingData::ApplicationRecord 96 mock(s) out of 98 failed. To see more/less detail set...
Fix this limitation. A record that has been created and then is modified will persist changes without calling #save.
Looking for support in documenting useful things, both in the readme and in the code. If you find value in the project please consider giving back to the community.