From e52a8742b3ca76f30d7e002da8e48cc647c21e1f Mon Sep 17 00:00:00 2001 From: Joe Ferris Date: Tue, 8 Nov 2011 17:36:32 -0500 Subject: [PATCH] Split up long method --- lib/fake_braintree.rb | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/fake_braintree.rb b/lib/fake_braintree.rb index 9b8f14e..3b988fb 100644 --- a/lib/fake_braintree.rb +++ b/lib/fake_braintree.rb @@ -24,15 +24,9 @@ class << self end def self.activate! - Braintree::Configuration.environment = :development - Braintree::Configuration.merchant_id = "xxx" - Braintree::Configuration.public_key = "xxx" - Braintree::Configuration.private_key = "xxx" + set_configuration clear! - Capybara.server_port = 3000 - server = Capybara::Server.new(FakeBraintree::SinatraApp) - server.boot - ENV['GATEWAY_PORT'] = server.port.to_s + boot_server end def self.log_file_path @@ -100,6 +94,22 @@ def self.credit_card_from_token(token) return card if card end end + + private + + def self.set_configuration + Braintree::Configuration.environment = :development + Braintree::Configuration.merchant_id = "xxx" + Braintree::Configuration.public_key = "xxx" + Braintree::Configuration.private_key = "xxx" + end + + def self.boot_server + Capybara.server_port = 3000 + server = Capybara::Server.new(FakeBraintree::SinatraApp) + server.boot + ENV['GATEWAY_PORT'] = server.port.to_s + end end FakeBraintree.activate!