Created
April 10, 2020 18:25
-
-
Save odlp/6d39768a72678dd30f68c098c4a642df to your computer and use it in GitHub Desktop.
Test caching mechanism
This file contains hidden or 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
it "doesn't make further requests when the cache is warm" do | |
stub = stub_request(:get, "www.amazon.com") | |
Amazon::API.new.item_prices("id") | |
Amazon::API.new.item_prices("id") | |
# https://github.com/bblimke/webmock#setting-expectations-in-rspec-on-the-stub | |
expect(stub).to have_been_requested.once | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment