Skip to content

Commit

Permalink
Split up long method
Browse files Browse the repository at this point in the history
  • Loading branch information
jferris committed Nov 8, 2011
1 parent b345058 commit e52a874
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions lib/fake_braintree.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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!
Expand Down

0 comments on commit e52a874

Please sign in to comment.