On Sat, Mar 29, 2008 at 9:23 PM, David Beckwith <[EMAIL PROTECTED]> wrote: > describe "pretending to crawl craigslist." do > > before do > @html_start = File.read( RAILS_ROOT + "/spec/fixtures/feeds/ > start_page.html" ) > @response_start = mock_model( Net::HTTP, :body => > @html_start, :nil? => false ) > @hawlee_start = Hawlee.new(@uri_start, nil, 0) > @htgrep = Hawler.new > end > > it "my get method get_it should be called at least once and return a > fake response." do > @htgrep.hawler.should_receive(:get_it).with(anything(), > @hawlee_start).and_return(@response_start) > end > > Here is the Error I'm getting (reformatted for easier reading): > > Spec::Mocks::MockExpectationError in 'Htgrep Define a blacklist > function that inputs a url and returns true or false. If true, the > page is on the blacklist and shouldn't be crawled: Hawler's get_it > method should be called with okay.html at least once.' > > Mock 'Hawler' expected :get_it with > > (#<Spec::Mocks::AnyArgConstraint:0x2ef6c10>, > > #<Hawlee:0x2f0817c @analyze=false, @referer=nil, @uri=#<URI::HTTP: > 0x1784640 URL:http://sfbay.craigslist.org/start_page.html>, > @harvest=false, @depth=0, @get=false, @head=false>) > > but received it with > > (#<URI::HTTP:0x177ad66 URL:http://sfbay.craigslist.org/ > start_page.html>, > > #<Hawlee:0x2ef575c @analyze=false, @referer=nil, @uri=#<URI::HTTP: > 0x177ad66 URL:http://sfbay.craigslist.org/start_page.html>, > @harvest=false, @depth=0, @get=false, @head=false>) > > ----------------- > > I think argument constraints use "==" to see if the argument > expectation works. Is that right? So, I made a method called "==" > for Hawlee which just compares the enclosed URI object. And I tested > to make sure this == operator works as expected.
Can you please post that test? > > Anyway, my argument constraint is not matching but I'm pretty sure > it's being called correctly. Does anybody have an idea of what is > going wrong here? > > Thank you for your suggestions, > David :) > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users