Created
August 15, 2013 21:20
-
-
Save kitwalker12/6245012 to your computer and use it in GitHub Desktop.
Rspec & VCR to mock API calls
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
require 'spec_helper' | |
feature "My Feature: " do | |
context "User Registers" do | |
scenario "through api" do | |
VCR.use_cassette "register_new_user", :record => :new_episodes do | |
#make api call | |
end | |
end | |
end | |
end |
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
#.. | |
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} | |
RSpec.configure do |config| | |
#... | |
end | |
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
require 'vcr' | |
VCR.configure do |c| | |
c.cassette_library_dir = 'spec/vcr' | |
c.hook_into :webmock | |
c.default_cassette_options = { :record => :none } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment