Created
August 10, 2011 05:21
-
-
Save smsohan/1136189 to your computer and use it in GitHub Desktop.
what_to_test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#example_code | |
def search(query, page_number) | |
third_party_search_library.search("*{query}*").from(page_number * page_size).size(page_size).matched_results | |
end | |
#example_unit_test | |
it "should search for partial match and return paged result" do | |
third_party_search_library.should_receive(:search).with('*new york*').and_return(cities) | |
cities.should_receive(:from).with(40).and_return(cities) | |
cities.should_receive(:size).with(20).and_return(cities) | |
City.search('new york', 2).should == cities | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment