Created
May 13, 2015 02:38
-
-
Save gabeodess/05f0927c606d01fe768b to your computer and use it in GitHub Desktop.
Class Inheritance
This file contains hidden or 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
class Shippo::Address < Shippo::TestBase | |
@@store = {:test => 'Address'} | |
cattr_reader :store | |
end |
This file contains hidden or 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
class Shippo::TestBase | |
def self.create(options) | |
options[:id] = rand | |
@@store[options[:id]] = options | |
end | |
end |
This file contains hidden or 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
Shippo::Address.create({}) | |
NameError: uninitialized class variable @@store in Shippo::TestBase | |
from /Users/gabeodess/Sites/share_coffee/test/stubs/shippo/test_base.rb:5:in `create' |
This file contains hidden or 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
class Shippo::Transaction < Shippo::TestBase | |
@@store = {:tst => 'transaction'} | |
cattr_reader :store | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment