I'm looking to test that a class method calls a specific instance method. Is there any way to do this? This is the best I've got, but it fails.
describe '#foo' do
let(:job) { create :job }
it 'calls job.bar' do
job.should_receive(:bar)
Job.foo
end
end
I need to be sure that the right instance of job is called, not just any instance. I appreciate any help.
#foocalles the instance method#baron the same instance. You aren't testing class methods at all. Which one is supposed to be an method on the class?.fooget the instance to call? Is it doing an activerecord.findor something like that?