Skip to content

Instantly share code, notes, and snippets.

@linojon
Created September 4, 2009 20:17
Show Gist options
  • Save linojon/181099 to your computer and use it in GitHub Desktop.
Save linojon/181099 to your computer and use it in GitHub Desktop.
## gem file bogus.rb
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
# Bogus Gateway
class BogusGateway < Gateway
AUTHORIZATION = '53433'
SUCCESS_MESSAGE = "Bogus Gateway: Forced success"
...
## File: config/initializers/active_merchant/bogus.rb
class BogusGateway < ActiveMerchant::Billing::Gateway
def authorize(money, creditcard_or_id, options = {})
# (abbreviated)
Response.new(true, SUCCESS_MESSAGE)
end
end
## spec_helper.rb
include ActiveMerchant::Billing
## spec
result.message.should == BogusGateway::SUCCESS_MESSAGE
## Error:
uninitialized constant BogusGateway::SUCCESS_MESSAGE
## when i change the spec to this is works
result.message.should == ActiveMerchant::Billing::BogusGateway::SUCCESS_MESSAGE
## perhaps rspec_helper is called before the initializer?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment