Created
October 3, 2012 21:22
-
-
Save raphaelcm/3829933 to your computer and use it in GitHub Desktop.
persistence bug repro case
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
class PersistenceTest | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
BRAINTREE_SYNC_STATUSES = %w(new synced changed) | |
# | |
# Top-level Fields | |
# | |
field :terms_accepted_at, :type => DateTime | |
field :first_billing_date, :type => Date | |
field :next_billing_date, :type => Date | |
field :trial_duration, :type => Integer, :default => 0 | |
field :charge_attempts, :type => Integer, :default => 0 | |
field :migrated_pmt, :type => String | |
field :pre_coins_hub, :type => Boolean, :default => false | |
field :braintree_billing, :type => Boolean, :default => true | |
field :sync_status, :type => String, :default => "new" | |
field :reminder_sent, :type => Boolean, :default => false | |
field :override_amount, :type => Integer | |
field :terms_accepted_at, :type => DateTime | |
field :activated_at, :type => DateTime | |
# | |
# Validations | |
# | |
validates_inclusion_of :sync_status, :in => BRAINTREE_SYNC_STATUSES | |
def created_in_braintree? | |
self.sync_status != "new" | |
end | |
def synced? | |
self.sync_status == "synced" | |
end | |
def changed? | |
self.sync_status == "changed" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment