Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Add VCR
Browse files Browse the repository at this point in the history
Adds the VCR gem, appropriate configuration, and enables it for gateway
specs.
  • Loading branch information
stewart committed Sep 1, 2016
1 parent 834dc1d commit 93c781c
Show file tree
Hide file tree
Showing 4 changed files with 342 additions and 1 deletion.
1 change: 1 addition & 0 deletions solidus_paypal_braintree.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ Gem::Specification.new do |s|
s.add_development_dependency 'simplecov'
s.add_development_dependency 'sqlite3'
s.add_development_dependency 'webmock'
s.add_development_dependency 'vcr'
end
326 changes: 326 additions & 0 deletions spec/fixtures/cassettes/solidus_paypal_braintree_gateway.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion spec/models/solidus_paypal_braintree/gateway_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
require 'webmock'
require 'support/order_ready_for_payment'

RSpec.describe SolidusPaypalBraintree::Gateway do
vcr_options = {
cassette_name: "solidus_paypal_braintree_gateway",
record: :new_episodes
}

RSpec.describe SolidusPaypalBraintree::Gateway, vcr: vcr_options do
let(:source) do
SolidusPaypalBraintree::Source.new(
nonce: 'fake-paypal-future-nonce'
Expand Down
9 changes: 9 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
require File.expand_path('../dummy/config/environment.rb', __FILE__)

require 'rspec/rails'
require 'vcr'
require 'webmock'
require 'database_cleaner'
require 'ffaker'

Expand All @@ -40,6 +42,13 @@
Braintree::Configuration.private_key = 'a9298f43b30c699db3072cc4a00f7f49'
Braintree::Configuration.merchant_id = '7rdg92j7bm7fk5h3'

VCR.configure do |c|
c.cassette_library_dir = "spec/fixtures/cassettes"
c.hook_into :webmock
c.ignore_localhost = true
c.configure_rspec_metadata!
end

RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods

Expand Down

0 comments on commit 93c781c

Please sign in to comment.