test/unit/callbacks_test.rb in superstore-2.4.4 vs test/unit/callbacks_test.rb in superstore-2.5.0
- old
+ new
@@ -1,11 +1,11 @@
require 'test_helper'
class Superstore::CallbacksTest < Superstore::TestCase
class TestIssue < Superstore::Base
self.table_name = 'issues'
- string :description
+ attribute :description, type: :string
%w(
before_validation
after_validation
before_save
@@ -33,23 +33,23 @@
expected = %w(
before_validation
after_validation
before_save
- after_save
after_create
+ after_save
)
assert_equal expected, issue.callback_history
end
test 'update' do
issue = TestIssue.create
issue.reset_callback_history
issue.update_attribute :description, 'foo'
- assert_equal %w(before_save after_save after_update), issue.callback_history
+ assert_equal %w(before_save after_update after_save), issue.callback_history
end
test 'destroy' do
issue = TestIssue.create
issue.reset_callback_history
@@ -60,10 +60,10 @@
end
test 'new_record during callbacks' do
class NewRecordTestClass < Superstore::Base
self.table_name = 'issues'
- string :description
+ attribute :description, type: :string
before_create :expect_new_record
before_save :expect_new_record
after_create :refute_new_record
after_save :refute_new_record