Permalink
Browse files

Implement and test private method all_timestamp_attributes_in_model

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information...
1 parent 4731576 commit a5b03e9c7af8f539764a66f9bd51b7ebbcb9f57d @franckverrot franckverrot committed with spastorino Jan 25, 2011
Showing with 9 additions and 0 deletions.
  1. +4 −0 activerecord/lib/active_record/timestamp.rb
  2. +5 −0 activerecord/test/cases/timestamp_test.rb
@@ -74,6 +74,10 @@ def timestamp_attributes_for_update_in_model
timestamp_attributes_for_update.select { |c| self.class.column_names.include?(c.to_s) }
end
+ def all_timestamp_attributes_in_model
+ timestamp_attributes_for_create_in_model + timestamp_attributes_for_update_in_model
+ end
+
def timestamp_attributes_for_update #:nodoc:
[:updated_at, :updated_on]
end
@@ -165,4 +165,9 @@ def test_timestamp_attributes_for_update_in_model
toy = Toy.first
assert_equal toy.send(:timestamp_attributes_for_update_in_model), [:updated_at]
end
+
+ def test_all_timestamp_attributes_in_model
+ toy = Toy.first
+ assert_equal toy.send(:all_timestamp_attributes_in_model), [:created_at, :updated_at]
+ end
end

0 comments on commit a5b03e9

Please sign in to comment.