ActiveRecord belongs_to ActiveResource

class Thing < ActiveRecord::Base
belongs_to :other_thing

class OtherThing < ActiveResource::Base = …

The association here works. I can access other_thing from thing with
no problems until, as usual, testing. Specifically functionally test
the things_controller. The things controller is simple scaffold,
however, having the association to an active resource model causes
functional tests to error because they don’t make the required request
to the resource, dispite using the ActiveRecord::HttpMock… mechanism
in the functional test.

So I have three questions really.
One, is this type of relationship something that we can expect to work
in rails? Or am I running off the rails here?
Two, assuming that this is an acceptable use case. Using TDD, as
apposed to BDD. Is there infrastructure already in rails for
functionally testing this?
Three, are there any other suggestions? (e.g. Stubbing
@thing.other_thing, plugins that do this, etc)

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