From 5ffaaa71d149c9807260c950c9a61d01fe734827 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 20 Jul 2009 00:27:04 +0900 Subject: Define ActiveModel API Compliance - Define to_model on AR - Define to_model on ActiveModel::APICompliant - Update test fixtures to be API Compliant - Start using to_model in AP --- actionpack/test/template/active_record_helper_test.rb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'actionpack/test/template/active_record_helper_test.rb') diff --git a/actionpack/test/template/active_record_helper_test.rb b/actionpack/test/template/active_record_helper_test.rb index e1be048838..950072e45b 100644 --- a/actionpack/test/template/active_record_helper_test.rb +++ b/actionpack/test/template/active_record_helper_test.rb @@ -4,19 +4,17 @@ class ActiveRecordHelperTest < ActionView::TestCase tests ActionView::Helpers::ActiveRecordHelper silence_warnings do - Post = Struct.new("Post", :title, :author_name, :body, :secret, :written_on) - Post.class_eval do - alias_method :title_before_type_cast, :title unless respond_to?(:title_before_type_cast) - alias_method :body_before_type_cast, :body unless respond_to?(:body_before_type_cast) - alias_method :author_name_before_type_cast, :author_name unless respond_to?(:author_name_before_type_cast) + class Post < Struct.new(:title, :author_name, :body, :secret, :written_on) + extend ActiveModel::APICompliant end - User = Struct.new("User", :email) - User.class_eval do - alias_method :email_before_type_cast, :email unless respond_to?(:email_before_type_cast) + class User < Struct.new(:email) + extend ActiveModel::APICompliant end - Column = Struct.new("Column", :type, :name, :human_name) + class Column < Struct.new(:type, :name, :human_name) + extend ActiveModel::APICompliant + end end class DirtyPost -- cgit v1.2.3