rspec-mocks icon indicating copy to clipboard operation
rspec-mocks copied to clipboard

Minitest integration fails to load ActiveModel methods

Open fidalgo opened this issue 6 years ago • 1 comments

Hi there! I'm using rspec-mocks (3.7.0) with minitest (5.10.3) and whenever I try to use instance_double on a Rails model, I have some missing methods, that should exist given the table mapping. I understand that Rails needs to do a first call in order to create the methods, but I would expect that to happen under the wood in our tests.

Another curious thing is if I do a drop, create and migrate the test will fail, but will pass on the second run.

If I force to load every Model in rails in the setup, all tests will pass, not matter if it's a empty database or not.

I'm not sure if this is a bug or a misconfiguration, but since my setup is uncommon I will leave here the report in case it would help.

Even with this in the configuration it will not work:

RSpec::Mocks.configuration.before_verifying_doubles do |reference|
    reference.target.define_attribute_methods
end

fidalgo avatar Jan 23 '18 14:01 fidalgo