Testing includes

Should one be testing things like ‘include FooBar’ when testing a model?

  • Where FooBar is an externally maintained and separately tested module.

Thanks,

~ Mark

Hi Mark,

Mark D. wrote:

Should one be testing things like ‘include FooBar’
when testing a model?

  • Where FooBar is an externally maintained and
    separately tested module.

My rule of thumb is to write tests that protect me from / let me
refactor
the layer ‘below’. So in this case, for example, I’d write unit tests
for
the things I was doing in my model that depend on the included module to
‘protect’ me if 1) I decide to use a new library for that functionality,
or
2) there’s an update to that module and I want to make sure the changes
to
it haven’t adversely affected my app, or 3) the include statement in the
model somehow gets deleted.

HTH,
Bill

Thanks Bill, that’s really helpful.

~ Mark

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs