Skip to content

Instantly share code, notes, and snippets.

@steveburkett
Created August 30, 2011 19:37
Show Gist options
  • Save steveburkett/1181807 to your computer and use it in GitHub Desktop.
Save steveburkett/1181807 to your computer and use it in GitHub Desktop.
mock example
it "should lookup by last_updated for abc files" do
update_time = Time.now
# create a location to match this update_time here
file = double("file")
file.should_receive(:extension).and_return("abc")
file.should_receive(:last_update).and_return(update_time)
MyClass.load_file(file).should == Location.find_by_lookup(update_time)
end
it "should lookup by extension for all other files" do
# create a location to match the "def" extension here
file = double("file")
file.should_receive(:extension).twice.and_return("def")
file.should_not_receive(:last_update)
MyClass.load_file(file).should == Location.find_by_lookup("def")
end
@steveburkett
Copy link
Author

I have fond memories of singing kumbaya around a campfire

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment