Sha256: 1b1c6b01ed4a8a20030863c753775cbebf3a6b7efa5cec4fbffccf559d25fc73
Contents?: true
Size: 1.04 KB
Versions: 21
Compression:
Stored size: 1.04 KB
Contents
require 'test_helper' class CassandraObject::CallbacksTest < CassandraObject::TestCase class TestIssue < CassandraObject::Base self.column_family = 'Issues' string :description %w(before_validation after_validation after_save after_create after_update after_destroy).each do |method| send(method) do callback_history << method end end def reset_callback_history @callback_history = [] end def callback_history @callback_history ||= [] end end test 'create' do issue = TestIssue.create assert_equal ['before_validation', 'after_validation', 'after_save', 'after_create'], issue.callback_history end test 'update' do issue = TestIssue.create issue.reset_callback_history issue.update_attribute :description, 'foo' assert_equal ['after_save', 'after_update'], issue.callback_history end test 'destroy' do issue = TestIssue.create issue.reset_callback_history issue.destroy assert_equal ['after_destroy'], issue.callback_history end end
Version data entries
21 entries across 21 versions & 1 rubygems