Skip to content

Commit

Permalink
Merge pull request #1 from solidusio/fix/test-environment
Browse files Browse the repository at this point in the history
FIx Up Test Environment
  • Loading branch information
adammathys authored Sep 2, 2016
2 parents 2a8e656 + b232422 commit a9ccb3a
Show file tree
Hide file tree
Showing 6 changed files with 350 additions and 7 deletions.
2 changes: 0 additions & 2 deletions .bundle/config

This file was deleted.

4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ gem 'solidus', github: 'solidusio/solidus'
# Provides basic authentication functionality for testing parts of your engine
gem 'solidus_auth_devise', '~> 1.0'

group :test do
gem 'rails-controller-testing'
end

gemspec
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
17 changes: 13 additions & 4 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 @@ -35,10 +37,17 @@

require 'braintree'

Braintree::Configuration.public_key = ENV.fetch('BRAINTREE_PUBLIC_KEY')
Braintree::Configuration.private_key = ENV.fetch('BRAINTREE_PRIVATE_KEY')
Braintree::Configuration.merchant_id = ENV.fetch('BRAINTREE_MERCHANT_ID')
Braintree::Configuration.environment = ENV.fetch('BRAINTREE_ENVIRONMENT', :sandbox).to_sym
Braintree::Configuration.environment = :sandbox
Braintree::Configuration.public_key = 'mwjkkxwcp32ckhnf'
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 a9ccb3a

Please sign in to comment.