aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-02-05 16:19:29 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-02-05 16:19:29 -0200
commit0caac9bf9b58f29f474675c18366413364df87c1 (patch)
tree8df32d0088b4f1da0b4acf59c33bdb07f3c158b6 /actionview/test/lib
parent79100b8a3a8057c5826dc064fea91b73f0080b4c (diff)
downloadrails-0caac9bf9b58f29f474675c18366413364df87c1.tar.gz
rails-0caac9bf9b58f29f474675c18366413364df87c1.tar.bz2
rails-0caac9bf9b58f29f474675c18366413364df87c1.zip
Add tests to make sure label and placeholder respect to_model
Diffstat (limited to 'actionview/test/lib')
-rw-r--r--actionview/test/lib/controller/fake_models.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/actionview/test/lib/controller/fake_models.rb b/actionview/test/lib/controller/fake_models.rb
index 789b1d198b..65c68fc34a 100644
--- a/actionview/test/lib/controller/fake_models.rb
+++ b/actionview/test/lib/controller/fake_models.rb
@@ -54,6 +54,22 @@ class Post < Struct.new(:title, :author_name, :body, :secret, :persisted, :writt
def tags_attributes=(attributes); end
end
+class PostDelegator < Post
+ def to_model
+ PostDelegate.new
+ end
+end
+
+class PostDelegate < Post
+ def self.human_attribute_name(attribute)
+ "Delegate #{super}"
+ end
+
+ def model_name
+ ActiveModel::Name.new(self.class)
+ end
+end
+
class Comment
extend ActiveModel::Naming
include ActiveModel::Conversion