diff options
Diffstat (limited to 'actionpack/test/lib')
-rw-r--r-- | actionpack/test/lib/controller/fake_controllers.rb | 31 | ||||
-rw-r--r-- | actionpack/test/lib/controller/fake_models.rb | 25 | ||||
-rw-r--r-- | actionpack/test/lib/testing_sandbox.rb | 15 |
3 files changed, 16 insertions, 55 deletions
diff --git a/actionpack/test/lib/controller/fake_controllers.rb b/actionpack/test/lib/controller/fake_controllers.rb index 09692f77b5..1a2863b689 100644 --- a/actionpack/test/lib/controller/fake_controllers.rb +++ b/actionpack/test/lib/controller/fake_controllers.rb @@ -1,11 +1,7 @@ -class << Object; alias_method :const_available?, :const_defined?; end - class ContentController < ActionController::Base; end module Admin - class << self; alias_method :const_available?, :const_defined?; end class AccountsController < ActionController::Base; end - class NewsFeedController < ActionController::Base; end class PostsController < ActionController::Base; end class StuffController < ActionController::Base; end class UserController < ActionController::Base; end @@ -17,46 +13,23 @@ module Api class ProductsController < ActionController::Base; end end -# TODO: Reduce the number of test controllers we use class AccountController < ActionController::Base; end -class AddressesController < ActionController::Base; end class ArchiveController < ActionController::Base; end class ArticlesController < ActionController::Base; end class BarController < ActionController::Base; end class BlogController < ActionController::Base; end class BooksController < ActionController::Base; end -class BraveController < ActionController::Base; end class CarsController < ActionController::Base; end class CcController < ActionController::Base; end class CController < ActionController::Base; end -class ElsewhereController < ActionController::Base; end class FooController < ActionController::Base; end class GeocodeController < ActionController::Base; end -class HiController < ActionController::Base; end -class ImageController < ActionController::Base; end class NewsController < ActionController::Base; end class NotesController < ActionController::Base; end +class PagesController < ActionController::Base; end class PeopleController < ActionController::Base; end class PostsController < ActionController::Base; end -class SessionsController < ActionController::Base; end -class StuffController < ActionController::Base; end class SubpathBooksController < ActionController::Base; end class SymbolsController < ActionController::Base; end class UserController < ActionController::Base; end -class WeblogController < ActionController::Base; end - -# For speed test -class SpeedController < ActionController::Base; end -class SearchController < SpeedController; end -class VideosController < SpeedController; end -class VideoFileController < SpeedController; end -class VideoSharesController < SpeedController; end -class VideoAbusesController < SpeedController; end -class VideoUploadsController < SpeedController; end -class VideoVisitsController < SpeedController; end -class UsersController < SpeedController; end -class SettingsController < SpeedController; end -class ChannelsController < SpeedController; end -class ChannelVideosController < SpeedController; end -class LostPasswordsController < SpeedController; end -class PagesController < SpeedController; end +class UsersController < ActionController::Base; end diff --git a/actionpack/test/lib/controller/fake_models.rb b/actionpack/test/lib/controller/fake_models.rb index cbef74f992..bbb4cc5ef3 100644 --- a/actionpack/test/lib/controller/fake_models.rb +++ b/actionpack/test/lib/controller/fake_models.rb @@ -34,6 +34,16 @@ end class GoodCustomer < Customer end +class ValidatedCustomer < Customer + def errors + if name =~ /Sikachu/i + [] + else + [{:name => "is invalid"}] + end + end +end + module Quiz class Question < Struct.new(:name, :id) extend ActiveModel::Naming @@ -48,26 +58,19 @@ module Quiz end end -class Post < Struct.new(:title, :author_name, :body, :secret, :written_on, :cost) +class Post < Struct.new(:title, :author_name, :body, :secret, :persisted, :written_on, :cost) extend ActiveModel::Naming include ActiveModel::Conversion extend ActiveModel::Translation alias_method :secret?, :secret + alias_method :persisted?, :persisted def initialize(*args) super @persisted = false end - def persisted=(boolean) - @persisted = boolean - end - - def persisted? - @persisted - end - attr_accessor :author def author_attributes=(attributes); end @@ -182,8 +185,8 @@ class HashBackedAuthor < Hash end module Blog - def self._railtie - self + def self.use_relative_model_naming? + true end class Post < Struct.new(:title, :id) diff --git a/actionpack/test/lib/testing_sandbox.rb b/actionpack/test/lib/testing_sandbox.rb deleted file mode 100644 index c36585104f..0000000000 --- a/actionpack/test/lib/testing_sandbox.rb +++ /dev/null @@ -1,15 +0,0 @@ -module TestingSandbox - # Temporarily replaces KCODE for the block - def with_kcode(kcode) - if RUBY_VERSION < '1.9' - old_kcode, $KCODE = $KCODE, kcode - begin - yield - ensure - $KCODE = old_kcode - end - else - yield - end - end -end |