Top Level Namespace

Includes:
FactoryGirl::Syntax::Methods

Defined Under Namespace

Modules: Laundry Classes: Module

Instance Method Summary collapse

Instance Method Details

#stub_allObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/laundry/stubbed.rb', line 22

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(build(:client))
  Laundry::PaymentsGateway::ClientDriver.any_instance.stub(:create!).and_return(build(:client).id)


  # Stub account driver
  Laundry::PaymentsGateway::AccountDriver.any_instance.stub(:find).and_return(build(:account))
  Laundry::PaymentsGateway::AccountDriver.any_instance.stub(:create!).and_return(build(:account).id)

  # Stub performing transactions.
  Laundry::PaymentsGateway::Account.any_instance.stub(:perform_transaction).and_return(build(:transaction_response))

  Laundry.stub(:stubbed?).and_return true
end