aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/lib
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2017-02-02 16:43:29 +0900
committerAkira Matsuda <ronnie@dio.jp>2017-02-02 16:43:29 +0900
commit0157608508cdb432b37324e1653b60d6b2e8c692 (patch)
tree4fb2f2a44d56fa9eb9df3beb8b2f041dec89ae6e /actionview/test/lib
parentc684f4f3da5665f3571307e4eabdcdeedf7b5aa2 (diff)
downloadrails-0157608508cdb432b37324e1653b60d6b2e8c692.tar.gz
rails-0157608508cdb432b37324e1653b60d6b2e8c692.tar.bz2
rails-0157608508cdb432b37324e1653b60d6b2e8c692.zip
DRY fake models for testing
Diffstat (limited to 'actionview/test/lib')
-rw-r--r--actionview/test/lib/controller/fake_models.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/actionview/test/lib/controller/fake_models.rb b/actionview/test/lib/controller/fake_models.rb
index 8db52ccbe1..5250101220 100644
--- a/actionview/test/lib/controller/fake_models.rb
+++ b/actionview/test/lib/controller/fake_models.rb
@@ -26,11 +26,15 @@ Customer = Struct.new(:name, :id) do
def persisted?
id.present?
end
-end
-class GoodCustomer < Customer
+ def cache_key
+ name.to_s
+ end
end
+class BadCustomer < Customer; end
+class GoodCustomer < Customer; end
+
Post = Struct.new(:title, :author_name, :body, :secret, :persisted, :written_on, :cost) do
extend ActiveModel::Naming
include ActiveModel::Conversion