diff options
author | Akira Matsuda <ronnie@dio.jp> | 2017-02-02 16:43:29 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2017-02-02 16:43:29 +0900 |
commit | 0157608508cdb432b37324e1653b60d6b2e8c692 (patch) | |
tree | 4fb2f2a44d56fa9eb9df3beb8b2f041dec89ae6e /actionview/test/actionpack | |
parent | c684f4f3da5665f3571307e4eabdcdeedf7b5aa2 (diff) | |
download | rails-0157608508cdb432b37324e1653b60d6b2e8c692.tar.gz rails-0157608508cdb432b37324e1653b60d6b2e8c692.tar.bz2 rails-0157608508cdb432b37324e1653b60d6b2e8c692.zip |
DRY fake models for testing
Diffstat (limited to 'actionview/test/actionpack')
-rw-r--r-- | actionview/test/actionpack/controller/render_test.rb | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/actionview/test/actionpack/controller/render_test.rb b/actionview/test/actionpack/controller/render_test.rb index 890041914c..51ec8899b1 100644 --- a/actionview/test/actionpack/controller/render_test.rb +++ b/actionview/test/actionpack/controller/render_test.rb @@ -1,42 +1,11 @@ require "abstract_unit" require "active_model" +require "controller/fake_models" class ApplicationController < ActionController::Base self.view_paths = File.join(FIXTURE_LOAD_PATH, "actionpack") end -Customer = Struct.new(:name, :id) do - extend ActiveModel::Naming - include ActiveModel::Conversion - - undef_method :to_json - - def to_xml(options = {}) - if options[:builder] - options[:builder].name name - else - "<name>#{name}</name>" - end - end - - def to_js(options = {}) - "name: #{name.inspect}" - end - alias :to_text :to_js - - def errors - [] - end - - def persisted? - id.present? - end - - def cache_key - name.to_s - end -end - module Quiz #Models Question = Struct.new(:name, :id) do @@ -56,9 +25,6 @@ module Quiz end end -class BadCustomer < Customer; end -class GoodCustomer < Customer; end - module Fun class GamesController < ApplicationController def hello_world; end |