How I can test ActiveRecord model relationship let's say:
class Order < ActiveRecord::Base
belongs_to :bucket
end
I would like to use Rspec
+ NullDB
to test bucket
association, so I need to test it without touching db.
How I can test ActiveRecord model relationship let's say:
class Order < ActiveRecord::Base
belongs_to :bucket
end
I would like to use Rspec
+ NullDB
to test bucket
association, so I need to test it without touching db.
Take a look at this question: Correct way of testing "associations" with Rspec?
I believe shoulda gem will help you.
You will be able to write something like that using it.
describe Order do
it { should belong_to(:bucket) }
end