Created
August 31, 2011 13:56
-
-
Save jg/1183589 to your computer and use it in GitHub Desktop.
VCR issue (2)
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 '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 |
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 './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 |
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 '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