Top Level Namespace
Defined Under Namespace
Modules: Laundry Classes: Module
Instance Method Summary collapse
Instance Method Details
#stub_all ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/laundry/stubbed.rb', line 13 def stub_all # Just stub away all the SOAP requests and such. classes = [Laundry::PaymentsGateway::MerchantAuthenticatableDriver, Laundry::PaymentsGateway::Merchant] classes.map{|c| [c.subclasses, c] }.flatten.uniq.each do |klass| klass.stub(:client_request).and_return true klass.stub(:client).and_return true klass.any_instance.stub(:setup_client!).and_return true end # Stub client driver Laundry::PaymentsGateway::ClientDriver.any_instance.stub(:find).and_return(Laundry.mock(:client)) Laundry::PaymentsGateway::ClientDriver.any_instance.stub(:create!).and_return(Laundry.mock(:client).id) # Stub account driver Laundry::PaymentsGateway::AccountDriver.any_instance.stub(:find).and_return(Laundry.mock(:account)) Laundry::PaymentsGateway::AccountDriver.any_instance.stub(:create!).and_return(Laundry.mock(:account).id) # Stub transaction driver Laundry::PaymentsGateway::TransactionDriver.any_instance.stub(:find).and_return(Laundry.mock(:transaction)) # Stub performing transactions. Laundry::PaymentsGateway::Account.any_instance.stub(:perform_transaction).and_return(Laundry.mock(:transaction_response)) Laundry.stub(:stubbed?).and_return true end |