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
require 'benchmark' | |
require 'ostruct' | |
REP = 1000000 | |
User = Struct.new(:name, :age) | |
USER = "User".freeze | |
AGE = 21 | |
HASH = {:name => USER, :age => AGE}.freeze |
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
# 1) Use VCR.use_cassette in your let block. This will use | |
# the cassette just for requests made by creating bar, not | |
# for anything else in your test. | |
let(:foo) { VCR.use_cassette("foo") { create(:bar) } } | |
it "uses foo" do | |
foo | |
end | |
# 2) Wrap the it block that uses #foo in VCR.use_cassette. |