Skip to content

Instantly share code, notes, and snippets.

@odlp
Created April 10, 2020 18:25
Show Gist options
  • Select an option

  • Save odlp/6d39768a72678dd30f68c098c4a642df to your computer and use it in GitHub Desktop.

Select an option

Save odlp/6d39768a72678dd30f68c098c4a642df to your computer and use it in GitHub Desktop.

Revisions

  1. odlp created this gist Apr 10, 2020.
    9 changes: 9 additions & 0 deletions cache_spec.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    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