Using Rails 4, Zeus 0.13.3, rspec-rails edge and mongoid edge
Simple STI model:
File my_model.rb
in /model
directory
class MyModel
include Mongoid::Document
field :my_field
end
File my_sti.rb
in /model/my_model
directory
class MyModel
class MySti << ::MyModel
field :some_other_field
end
end
Everything works as expected in console and web. When I run the spec via bundler:
bundle exec rspec spec
It'all good, but the issue is when I run them with zeus
, it throws:
<class:MySti>': undefined method
field' for MyModel::MySti:Class (NoMethodError)
2 ways of getting around the issue that I found so far:
commenting the
field
declaration in the STI, specs are running fine, but obviously business logic is not!re-adding the
include Mongoid::Document
definition in theMySti
class: spec and logic works fine with that, but I should not have to do that, and I am weary of possible unintended consequences of doing that.
Any ideas ?
Does adding a delegate work?
from documentation