Rename dummy to benchmark

This commit is contained in:
Benjamin Fleischer
2016-03-09 21:55:33 -06:00
parent 821dcda700
commit 666756f779
8 changed files with 19 additions and 19 deletions

View File

@@ -18,7 +18,7 @@ class NullLogger < Logger
def add(*_args, &_block)
end
end
class DummyLogger < ActiveSupport::Logger
class BenchmarkLogger < ActiveSupport::Logger
def initialize
@file = StringIO.new
super(@file)
@@ -30,7 +30,7 @@ class DummyLogger < ActiveSupport::Logger
end
end
# ref: https://gist.github.com/bf4/8744473
class DummyApp < Rails::Application
class BenchmarkApp < Rails::Application
# Set up production configuration
config.eager_load = true
config.cache_classes = true

View File

@@ -7,7 +7,7 @@ module Benchmark
module ActiveModelSerializers
module TestMethods
def request(method, path)
response = Rack::MockRequest.new(DummyApp).send(method, path)
response = Rack::MockRequest.new(BenchmarkApp).send(method, path)
if response.status.in?([404, 500])
fail "omg, #{method}, #{path}, '#{response.status}', '#{response.body}'"
end

View File

@@ -35,7 +35,7 @@ class PostController < ActionController::Base
ActionController::Base.cache_store.clear
# Test caching is on
# Uncomment to turn on logger; possible performance issue
# logger = DummyLogger.new
# logger = BenchmarkLogger.new
# ActiveSupport::Cache::Store.logger = logger # seems to be the best way
#
# the below is used in some rails tests but isn't available/working in all versions, so far as I can tell
@@ -57,7 +57,7 @@ class PostController < ActionController::Base
end
def cache_messages
ActiveSupport::Cache::Store.logger.is_a?(DummyLogger) && ActiveSupport::Cache::Store.logger.messages.split("\n")
ActiveSupport::Cache::Store.logger.is_a?(BenchmarkLogger) && ActiveSupport::Cache::Store.logger.messages.split("\n")
end
def toggle_cache_status

View File

@@ -104,7 +104,7 @@ else
# ActiveModelSerializers::Model is a convenient
# serializable class to inherit from when making
# serializable non-activerecord objects.
class DummyModel
class BenchmarkModel
include ActiveModel::Model
include ActiveModel::Serializers::JSON
@@ -139,19 +139,19 @@ else
end
end
class Comment < DummyModel
class Comment < BenchmarkModel
attr_accessor :id, :body
end
class Author < DummyModel
class Author < BenchmarkModel
attr_accessor :id, :name, :posts
end
class Post < DummyModel
class Post < BenchmarkModel
attr_accessor :id, :title, :body, :comments, :blog, :author
end
class Blog < DummyModel
class Blog < BenchmarkModel
attr_accessor :id, :name
end
end