Skip to content

Instantly share code, notes, and snippets.

@jg
Created August 31, 2011 13:56
Show Gist options
  • Save jg/1183589 to your computer and use it in GitHub Desktop.
Save jg/1183589 to your computer and use it in GitHub Desktop.
VCR issue (2)
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
require './spec_helper'
require './example'
describe Example do
context "context" do
use_vcr_cassette "example", :update_content_length_header => true
it "should be okay" do
t = Bowling.new
t.make_request_and_print_results.should_not be_nil
end
end
end
require 'vcr'
RSpec.configure do |config|
config.mock_with :rr
config.extend VCR::RSpec::Macros
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment