Skip to content

Commit eb51506

Browse files
author
Yohan Robert
committed
Merge pull request #1576 from bf4/rename_dummy_to_benchmark
Rename dummy to benchmark
2 parents 821dcda + 666756f commit eb51506

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

bin/bench

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require 'English'
1515

1616
class BenchmarkDriver
1717
ROOT = Pathname File.expand_path(File.join('..', '..'), __FILE__)
18-
BASE = ENV.fetch('BASE') { ROOT.join('test', 'dummy') }
18+
BASE = ENV.fetch('BASE') { ROOT.join('test', 'benchmark') }
1919
ESCAPED_BASE = Shellwords.shellescape(BASE)
2020

2121
def self.benchmark(options)

bin/serve_dummy renamed to bin/serve_benchmark

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@ set -e
44
case "$1" in
55

66
start)
7-
config="${CONFIG_RU:-test/dummy/config.ru}"
8-
bundle exec ruby -Ilib -S rackup "$config" --daemonize --pid tmp/dummy_app.pid --warn --server webrick
9-
until [ -f 'tmp/dummy_app.pid' ]; do
7+
config="${CONFIG_RU:-test/benchmark/config.ru}"
8+
bundle exec ruby -Ilib -S rackup "$config" --daemonize --pid tmp/benchmark_app.pid --warn --server webrick
9+
until [ -f 'tmp/benchmark_app.pid' ]; do
1010
sleep 0.1 # give it time to start.. I don't know a better way
1111
done
12-
cat tmp/dummy_app.pid
12+
cat tmp/benchmark_app.pid
1313
true
1414
;;
1515

1616
stop)
17-
if [ -f 'tmp/dummy_app.pid' ]; then
18-
kill -TERM $(cat tmp/dummy_app.pid)
17+
if [ -f 'tmp/benchmark_app.pid' ]; then
18+
kill -TERM $(cat tmp/benchmark_app.pid)
1919
else
2020
echo 'No pidfile'
2121
false
2222
fi
2323
;;
2424

2525
status)
26-
if [ -f 'tmp/dummy_app.pid' ]; then
27-
kill -0 $(cat tmp/dummy_app.pid)
26+
if [ -f 'tmp/benchmark_app.pid' ]; then
27+
kill -0 $(cat tmp/benchmark_app.pid)
2828
[ "$?" -eq 0 ]
2929
else
3030
echo 'No pidfile'

test/dummy/app.rb renamed to test/benchmark/app.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def initialize(*_args)
1818
def add(*_args, &_block)
1919
end
2020
end
21-
class DummyLogger < ActiveSupport::Logger
21+
class BenchmarkLogger < ActiveSupport::Logger
2222
def initialize
2323
@file = StringIO.new
2424
super(@file)
@@ -30,7 +30,7 @@ def messages
3030
end
3131
end
3232
# ref: https://gist.github.com/bf4/8744473
33-
class DummyApp < Rails::Application
33+
class BenchmarkApp < Rails::Application
3434
# Set up production configuration
3535
config.eager_load = true
3636
config.cache_classes = true

test/dummy/benchmarking_support.rb renamed to test/benchmark/benchmarking_support.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Benchmark
77
module ActiveModelSerializers
88
module TestMethods
99
def request(method, path)
10-
response = Rack::MockRequest.new(DummyApp).send(method, path)
10+
response = Rack::MockRequest.new(BenchmarkApp).send(method, path)
1111
if response.status.in?([404, 500])
1212
fail "omg, #{method}, #{path}, '#{response.status}', '#{response.body}'"
1313
end
File renamed without changes.
File renamed without changes.

test/dummy/controllers.rb renamed to test/benchmark/controllers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def clear
3535
ActionController::Base.cache_store.clear
3636
# Test caching is on
3737
# Uncomment to turn on logger; possible performance issue
38-
# logger = DummyLogger.new
38+
# logger = BenchmarkLogger.new
3939
# ActiveSupport::Cache::Store.logger = logger # seems to be the best way
4040
#
4141
# 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 @@ def cache_status
5757
end
5858

5959
def cache_messages
60-
ActiveSupport::Cache::Store.logger.is_a?(DummyLogger) && ActiveSupport::Cache::Store.logger.messages.split("\n")
60+
ActiveSupport::Cache::Store.logger.is_a?(BenchmarkLogger) && ActiveSupport::Cache::Store.logger.messages.split("\n")
6161
end
6262

6363
def toggle_cache_status

test/dummy/fixtures.rb renamed to test/benchmark/fixtures.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class Blog < ActiveRecord::Base
104104
# ActiveModelSerializers::Model is a convenient
105105
# serializable class to inherit from when making
106106
# serializable non-activerecord objects.
107-
class DummyModel
107+
class BenchmarkModel
108108
include ActiveModel::Model
109109
include ActiveModel::Serializers::JSON
110110

@@ -139,19 +139,19 @@ def read_attribute_for_serialization(key)
139139
end
140140
end
141141

142-
class Comment < DummyModel
142+
class Comment < BenchmarkModel
143143
attr_accessor :id, :body
144144
end
145145

146-
class Author < DummyModel
146+
class Author < BenchmarkModel
147147
attr_accessor :id, :name, :posts
148148
end
149149

150-
class Post < DummyModel
150+
class Post < BenchmarkModel
151151
attr_accessor :id, :title, :body, :comments, :blog, :author
152152
end
153153

154-
class Blog < DummyModel
154+
class Blog < BenchmarkModel
155155
attr_accessor :id, :name
156156
end
157157
end

0 commit comments

Comments
 (0)