Hi,
I have a sinatra app that I’ve integrated with Activerecord that I am
trying to write some specs for.
I have a simple spec where I am essentially getting “all” rows from my
model table.
However I’d like to stub out the call.
so… in my spec’s before block I try to do something like:
ActiveRecord::Base.should_receive(:establish_connection)
in my spec I do :
it “should retreive all ids” do
IdMap.should_receive(:find_all_by_site_id).with(“abc-123”).and_return("")
get “map/site1”
end
and my spec keeps failing on IdMap.should_receive…
It complains that it cannot connect to the database.
If I swap in mocha and do IdMap.expect… it works.
I’d prefer to stick with Rspec’s mocking and stubbing library in this
case tho… I was wondering if anyone could shed some light on whether
or not I am doing somethign wrong?
Thanks!
Jay