Skip to content

Instantly share code, notes, and snippets.

@tomtt
Created July 20, 2009 17:15
Show Gist options
  • Select an option

  • Save tomtt/150453 to your computer and use it in GitHub Desktop.

Select an option

Save tomtt/150453 to your computer and use it in GitHub Desktop.
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
class Bar
def self.search(a, b = {})
end
end
class Foo
def self.call_bar_stuff
@fish = Bar.search('fish', :limit => 3)
@birds = Bar.search('birds', :limit => 4)
end
end
describe Foo do
before do
Bar.stub!(:search)
end
it "should find no more than 3 fish" do
Bar.should_receive(:search).with('fish', hash_including(:limit => 3))
Foo.call_bar_stuff
end
it "should find no more than 4 birds" do
Bar.should_receive(:search).with('birds', hash_including(:limit => 4))
Foo.call_bar_stuff
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment