Skip to content

Instantly share code, notes, and snippets.

@jg
Created August 31, 2011 14:20
Show Gist options
  • Save jg/1183657 to your computer and use it in GitHub Desktop.
Save jg/1183657 to your computer and use it in GitHub Desktop.
VCR issue (3)
require 'vcr'
require 'mechanize'
VCR.config do |c|
c.cassette_library_dir = 'cassettes'
c.stub_with :webmock
c.default_cassette_options = { :record => :new_episodes }
end
class Example
def make_request_and_print_results
agent = Mechanize.new
page = agent.get('http://epaper.thunertagblatt.ch/')
form = page.forms[0]
form.submit
end
end
VCR.use_cassette('example') do
t = Example.new
t.make_request_and_print_results
end
source 'http://rubygems.org'
gem "vcr", '~> 1.11.2'
gem 'mechanize', '~> 2.0.1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment