Sha256: 0fada72336111e35b999535c68de1329c47b684e4ea6ef1b62ed55bc13046992
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
require 'test_helper' class CassandraObject::CallbacksTest < CassandraObject::TestCase class TestIssue < CassandraObject::Base self.column_family = 'Issues' key :uuid 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_create', 'after_save'], issue.callback_history end test 'update' do issue = TestIssue.create issue.reset_callback_history issue.update_attribute :description, 'foo' assert_equal ['after_update', 'after_save'], 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gotime-cassandra_object-2.11.0 | test/unit/callbacks_test.rb |
gotime-cassandra_object-2.10.11 | test/unit/callbacks_test.rb |
gotime-cassandra_object-2.10.10 | test/unit/callbacks_test.rb |