Created
April 16, 2012 04:20
-
-
Save tommeier/2396327 to your computer and use it in GitHub Desktop.
VCR with placeholders
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
use_vcr_cassette 'some/cassette', :tag => :bad_staging_api |
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
VCR.configure do |c| | |
c.cassette_library_dir = Rails.root.join('spec/fixtures/vcr_cassettes') | |
c.hook_into :webmock | |
c.default_cassette_options = { :record => :new_episodes } | |
c.before_record(:bad_staging_api) do |interaction, cassette| | |
interaction.response.body.gsub!(/TotalRate\=["']([^"']+)["']/, %q{TotalRate="<TOTAL_RATE>"}) | |
end | |
c.before_playback(:bad_staging_api) do |interaction| | |
interaction.filter!('<TOTAL_RATE>', "836.00") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment