#NEWLINE# def test_update_returns_error_if_invalid( self ) : #NEWLINE# #INDENT# customer = Customer . create ( ) . customer #NEWLINE# credit_card = CreditCard . create ( { #NEWLINE# #INDENT# 'customer_id' : customer . id , #NEWLINE# 'number' : '4111111111111111' , #NEWLINE# 'expiration_date' : '05/2014' , #NEWLINE# #UNINDENT# } ) . credit_card #NEWLINE# result = CreditCard . update ( credit_card . token , { #NEWLINE# #INDENT# 'expiration_date' : 'invalid_date' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertFalse ( result . is_success ) #NEWLINE# self . assertEquals ( ErrorCodes . CreditCard . ExpirationDateIsInvalid , result . errors . for_object ( 'credit_card' ) . on ( 'expiration_date' ) [ 0 ] . code )