We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: RESTful Rails app for storing credit cards
Clone URL: git://github.com/joevandyk/monkeycharger.git
when saving the card, should update the last four digits of the card

git-svn-id: https://monkeycharger.googlecode.com/svn@61 
ca20866a-8536-0410-a432-c7584e41aef3
joevandyk (author)
Mon Oct 15 17:44:16 -0700 2007
commit  2d7b96b3e829d7de3d61d0e514fae2b0aab843bc
tree    5a9f71cde7a436f15196c1e0c1c46e66f31bf7b2
parent  1dd51c177bb03079834473e680acbc2dd5709629
...
15
16
17
18
 
19
20
21
...
15
16
17
 
18
19
20
21
0
@@ -15,7 +15,7 @@ class CreditCard < ActiveRecord::Base
0
 
0
    before_validation :convert_number_to_string
0
    before_create :crypt_number
0
- before_create :save_last_four_digits
0
+ before_save :save_last_four_digits
0
 
0
    # Needed for authorize.net and active merchant
0
    def verification_value?
...
80
81
82
 
 
 
 
 
 
 
 
 
 
 
 
...
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
0
@@ -80,3 +80,15 @@ describe "We only take Visa and MasterCard" do
0
 end
0
 
0
 
0
+describe "Editing a saved credit card" do
0
+ before(:each) do
0
+ @card = generate_credit_card(:number => "4111111111111111")
0
+ @card.save!
0
+ end
0
+
0
+ it "should update the last four digits" do
0
+ @card.number = "4242424242424242"
0
+ @card.save!
0
+ @card.last_four_digits.should == "4242"
0
+ end
0
+end

Comments

    No one has commented yet.