Permalink
Browse files

Use VCR for faster testing

  • Loading branch information...
rylwin committed May 2, 2012
1 parent 1e031d4 commit b4e7cb9fca6ddcff270edf5e1ddddc70bf828e3a
Showing with 19 additions and 2 deletions.
  1. +1 −0 .gitignore
  2. +3 −1 Gemfile
  3. +4 −0 Gemfile.lock
  4. +2 −1 spec/merchant_account_spec.rb
  5. +9 −0 spec/spec_helper.rb
View
@@ -1 +1,2 @@
*.swp
+spec/cassettes
View
@@ -6,7 +6,9 @@ gem "activesupport", ">= 2.3.5"
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
- gem "rspec", "~> 2.8.0"
+ gem "rspec", "~> 2.8.0"
+ gem 'vcr', '~> 2.1.0'
+ gem 'fakeweb'
gem "rdoc", "~> 3.12"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.8.3"
View
@@ -5,6 +5,7 @@ GEM
i18n (~> 0.6)
multi_json (~> 1.0)
diff-lcs (1.1.3)
+ fakeweb (1.3.0)
git (1.2.5)
i18n (0.6.0)
jeweler (1.8.3)
@@ -26,14 +27,17 @@ GEM
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
+ vcr (2.1.1)
PLATFORMS
ruby
DEPENDENCIES
activesupport (>= 2.3.5)
bundler (~> 1.0.0)
+ fakeweb
jeweler (~> 1.8.3)
rcov
rdoc (~> 3.12)
rspec (~> 2.8.0)
+ vcr (~> 2.1.0)
@@ -1,6 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
-describe PaymentsGateway::MerchantAccount do
+describe PaymentsGateway::MerchantAccount, :vcr => { :re_record_interval => 1.day } do
before(:each) do
# Test account data
@@ -13,6 +13,7 @@
end
context "when I create a new client" do
+
before(:each) do
@client = PaymentsGateway::Client.new(
:first_name => 'John',
View
@@ -1,12 +1,21 @@
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
+require 'vcr'
require 'payments_gateway'
+VCR.configure do |c|
+ c.cassette_library_dir = 'spec/cassettes'
+ c.hook_into :fakeweb
+ c.configure_rspec_metadata!
+end
+
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
RSpec.configure do |config|
+ config.extend VCR::RSpec::Macros
+ config.treat_symbols_as_metadata_keys_with_true_values = true
#config.backtrace_clean_patterns = []
end

0 comments on commit b4e7cb9

Please sign in to comment.