Sha256: 6a6fb1798fead9936037f78658c3773eb455cc8279927b4288c2169686cdb132

Contents?: true

Size: 864 Bytes

Versions: 1

Compression:

Stored size: 864 Bytes

Contents

require "test_helper"

class CallbacksTest < ActiveSupport::TestCase
  
  def test_callbacks
    account = Account.create(:name => "blah")
    assert_equal [:before_validation_on_create, :before_validation, :after_validation, :after_validation_on_create, :before_create, :before_save, :after_save, :after_create], account.callbacks_made
    
    account.callbacks_made = []
    account.save
    assert_equal [:before_validation_on_update, :before_validation, :after_validation, :after_validation_on_update, :before_update, :before_save, :after_save, :after_update], account.callbacks_made
    
    account.callbacks_made = []
    account = Account.find(account.id)
    assert_equal [:after_find], account.callbacks_made
    
    account.callbacks_made = []
    account.destroy
    assert_equal [:before_destroy, :after_destroy], account.callbacks_made
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
curly_mustache-0.1.0 test/callbacks_test.rb