Created
September 4, 2009 20:17
-
-
Save linojon/181099 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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