I have the following model:
class Book < ActiveRecord::Base
has_many :taggings, :dependent => :delete_all
has_many :tags, :through => :taggings
end
is it possible to check that associated taggings are being destroyed
using mocks? I don't want to test that rails is deleting the
associations, I want to test that I have specified the association as
a dependent one.
the only way I can think of is to use fixtures (or create real
associations in the before callback) and then check that they have
been deleted using Taggings.count(). Can it be done using mocks
instead?
describe Book do
before do
@book = mock_model(Book)
@tagging = mock_model(Tagging)
@book.stub!(:taggings).and_return([@tagging, @tagging])
end
it "should delete associated taggings when destroyed" do
end
end
thanks
dave
_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users