On Sun, May 24, 2009 at 12:25 PM, Nick Hoffman <n...@deadorange.com> wrote: > Hi guys. I'm setting an expectation on a class method. For some > reason, the method isn't being stubbed, and the expectation isn't > seeing the call. > > In KeywordListsController#create, I call the private method > #create_keywords_and_associate, which calls AdSenseHeavenParser#parse > . > > Thus, some of my specs set an expectation on AdSenseHeavenParser#parse > . However, that expectation isn't stubbing out #parse .
That's because it isn't a class method, it's an instance method, so instead of: AdSenseHeavenParser.should_receive(:parse).with(keyword_list_contents).and_return({:keywords => [], :errors => []}) You should have controller.should_receive(:parse).with(keyword_list_contents).and_return({:keywords => [], :errors => []}) -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users