rails-perftest 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +6 -0
- data/LICENSE +22 -0
- data/README.md +696 -0
- data/Rakefile +37 -0
- data/bin/perftest +9 -0
- data/lib/generators/rails/app/templates/test/performance/browsing_test.rb +12 -0
- data/lib/generators/rails/performance_test/USAGE +10 -0
- data/lib/generators/rails/performance_test/performance_test_generator.rb +14 -0
- data/lib/generators/rails/performance_test/templates/performance_test.rb +12 -0
- data/lib/rails-perftest.rb +2 -0
- data/lib/rails/performance_test_help.rb +3 -0
- data/lib/rails/perftest/action_controller.rb +3 -0
- data/lib/rails/perftest/action_controller/performance_test.rb +3 -0
- data/lib/rails/perftest/action_dispatch.rb +3 -0
- data/lib/rails/perftest/action_dispatch/performance_test.rb +10 -0
- data/lib/rails/perftest/active_support/testing/performance.rb +271 -0
- data/lib/rails/perftest/active_support/testing/performance/jruby.rb +115 -0
- data/lib/rails/perftest/active_support/testing/performance/rubinius.rb +113 -0
- data/lib/rails/perftest/active_support/testing/performance/ruby.rb +173 -0
- data/lib/rails/perftest/commands.rb +30 -0
- data/lib/rails/perftest/commands/benchmarker.rb +34 -0
- data/lib/rails/perftest/commands/profiler.rb +32 -0
- data/lib/rails/perftest/railtie.rb +20 -0
- data/lib/rails/perftest/railties/testing.tasks +12 -0
- data/lib/rails/perftest/version.rb +5 -0
- data/rails-perftest.gemspec +26 -0
- data/rails-perftest.gemspec.erb +26 -0
- data/test/generators/generators_test_helper.rb +16 -0
- data/test/generators/performance_test_generator_test.rb +18 -0
- data/test/helper.rb +8 -0
- data/test/performance_test.rb +58 -0
- metadata +171 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/rails/perftest/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Yves Senn"]
|
6
|
+
gem.email = ["yves.senn@gmail.com"]
|
7
|
+
gem.description = %q{Rails performance tests (removed from core in Rails 4.0)}
|
8
|
+
gem.summary = %q{ActionDispatch::PerformanceTest, ActiveSupport::Testing::Performance extracted from Rails.}
|
9
|
+
gem.homepage = "https://github.com/rails/rails-perftest"
|
10
|
+
|
11
|
+
gem.files = [<%= files.map(&:inspect).join ',' %>]
|
12
|
+
gem.executables = [<%= executables.map(&:inspect).join ',' %>]
|
13
|
+
gem.test_files = [<%= test_files.map(&:inspect).join ',' %>]
|
14
|
+
gem.name = "rails-perftest"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Rails::Perftest::VERSION
|
17
|
+
|
18
|
+
gem.add_development_dependency 'ruby-prof'
|
19
|
+
gem.add_development_dependency 'minitest', '>= 3'
|
20
|
+
gem.add_development_dependency 'railties', '~> 4.0.0.beta'
|
21
|
+
gem.add_development_dependency 'activerecord', '~> 4.0.0.beta'
|
22
|
+
gem.add_development_dependency 'activemodel', '~> 4.0.0.beta'
|
23
|
+
gem.add_development_dependency 'actionmailer', '~> 4.0.0.beta'
|
24
|
+
gem.add_development_dependency 'actionpack', '~> 4.0.0.beta'
|
25
|
+
gem.add_development_dependency 'sqlite3', '~> 1.3'
|
26
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
require 'rails/all'
|
6
|
+
require 'rails/generators'
|
7
|
+
require 'rails/generators/test_case'
|
8
|
+
|
9
|
+
module TestApp
|
10
|
+
class Application < Rails::Application
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# Call configure to load the settings from
|
15
|
+
# Rails.application.config.generators to Rails::Generators
|
16
|
+
Rails.application.load_generators
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'generators/generators_test_helper'
|
2
|
+
require 'generators/rails/performance_test/performance_test_generator'
|
3
|
+
|
4
|
+
class PerformanceTestGeneratorTest < Rails::Generators::TestCase
|
5
|
+
tests Rails::Generators::PerformanceTestGenerator
|
6
|
+
arguments %w(dashboard)
|
7
|
+
destination File.expand_path("../../tmp", __FILE__)
|
8
|
+
|
9
|
+
def setup
|
10
|
+
super
|
11
|
+
prepare_destination
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_performance_test_skeleton_is_created
|
15
|
+
run_generator
|
16
|
+
assert_file "test/performance/dashboard_test.rb", /class DashboardTest < ActionDispatch::PerformanceTest/
|
17
|
+
end
|
18
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'rails/perftest/active_support/testing/performance'
|
3
|
+
|
4
|
+
module ActiveSupport
|
5
|
+
module Testing
|
6
|
+
class PerformanceTest < ActiveSupport::TestCase
|
7
|
+
|
8
|
+
def test_amount_format
|
9
|
+
amount_metric = ActiveSupport::Testing::Performance::Metrics[:amount].new
|
10
|
+
assert_equal "0", amount_metric.format(0)
|
11
|
+
assert_equal "1", amount_metric.format(1.23)
|
12
|
+
assert_equal "40,000,000", amount_metric.format(40000000)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_time_format
|
16
|
+
time_metric = ActiveSupport::Testing::Performance::Metrics[:time].new
|
17
|
+
assert_equal "0 ms", time_metric.format(0)
|
18
|
+
assert_equal "40 ms", time_metric.format(0.04)
|
19
|
+
assert_equal "41 ms", time_metric.format(0.0415)
|
20
|
+
assert_equal "1.23 sec", time_metric.format(1.23)
|
21
|
+
assert_equal "40000.00 sec", time_metric.format(40000)
|
22
|
+
assert_equal "-5000 ms", time_metric.format(-5)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_space_format
|
26
|
+
space_metric = ActiveSupport::Testing::Performance::Metrics[:digital_information_unit].new
|
27
|
+
assert_equal "0 Bytes", space_metric.format(0)
|
28
|
+
assert_equal "0 Bytes", space_metric.format(0.4)
|
29
|
+
assert_equal "1 Byte", space_metric.format(1.23)
|
30
|
+
assert_equal "123 Bytes", space_metric.format(123)
|
31
|
+
assert_equal "123 Bytes", space_metric.format(123.45)
|
32
|
+
assert_equal "12 KB", space_metric.format(12345)
|
33
|
+
assert_equal "1.2 MB", space_metric.format(1234567)
|
34
|
+
assert_equal "9.3 GB", space_metric.format(10**10)
|
35
|
+
assert_equal "91 TB", space_metric.format(10**14)
|
36
|
+
assert_equal "910000 TB", space_metric.format(10**18)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_environment_format_without_rails
|
40
|
+
metric = ActiveSupport::Testing::Performance::Metrics[:time].new
|
41
|
+
benchmarker = ActiveSupport::Testing::Performance::Benchmarker.new(self, metric)
|
42
|
+
assert_match "#{RUBY_ENGINE}-#{RUBY_VERSION}.#{RUBY_PATCHLEVEL},#{RUBY_PLATFORM}", benchmarker.environment
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_environment_format_with_rails
|
46
|
+
version = Module.new
|
47
|
+
version.const_set :STRING, "4.0.0"
|
48
|
+
Rails.const_set :VERSION, version
|
49
|
+
|
50
|
+
metric = ActiveSupport::Testing::Performance::Metrics[:time].new
|
51
|
+
benchmarker = ActiveSupport::Testing::Performance::Benchmarker.new(self, metric)
|
52
|
+
assert_match "rails-4.0.0,#{RUBY_ENGINE}-#{RUBY_VERSION}.#{RUBY_PATCHLEVEL},#{RUBY_PLATFORM}", benchmarker.environment
|
53
|
+
ensure
|
54
|
+
Object.send :remove_const, :Rails
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
metadata
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-perftest
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Yves Senn
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: ruby-prof
|
16
|
+
requirement: &70154369112060 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70154369112060
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: minitest
|
27
|
+
requirement: &70154369111060 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70154369111060
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: railties
|
38
|
+
requirement: &70154369110000 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 4.0.0.beta
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70154369110000
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: activerecord
|
49
|
+
requirement: &70154369109100 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.0.0.beta
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70154369109100
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: activemodel
|
60
|
+
requirement: &70154369108460 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 4.0.0.beta
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70154369108460
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: actionmailer
|
71
|
+
requirement: &70154369107840 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 4.0.0.beta
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70154369107840
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: actionpack
|
82
|
+
requirement: &70154369107020 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 4.0.0.beta
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70154369107020
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: sqlite3
|
93
|
+
requirement: &70154369106000 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ~>
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '1.3'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70154369106000
|
102
|
+
description: Rails performance tests (removed from core in Rails 4.0)
|
103
|
+
email:
|
104
|
+
- yves.senn@gmail.com
|
105
|
+
executables:
|
106
|
+
- perftest
|
107
|
+
extensions: []
|
108
|
+
extra_rdoc_files: []
|
109
|
+
files:
|
110
|
+
- .gitignore
|
111
|
+
- Gemfile
|
112
|
+
- LICENSE
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- bin/perftest
|
116
|
+
- lib/generators/rails/app/templates/test/performance/browsing_test.rb
|
117
|
+
- lib/generators/rails/performance_test/USAGE
|
118
|
+
- lib/generators/rails/performance_test/performance_test_generator.rb
|
119
|
+
- lib/generators/rails/performance_test/templates/performance_test.rb
|
120
|
+
- lib/rails-perftest.rb
|
121
|
+
- lib/rails/performance_test_help.rb
|
122
|
+
- lib/rails/perftest/action_controller.rb
|
123
|
+
- lib/rails/perftest/action_controller/performance_test.rb
|
124
|
+
- lib/rails/perftest/action_dispatch.rb
|
125
|
+
- lib/rails/perftest/action_dispatch/performance_test.rb
|
126
|
+
- lib/rails/perftest/active_support/testing/performance.rb
|
127
|
+
- lib/rails/perftest/active_support/testing/performance/jruby.rb
|
128
|
+
- lib/rails/perftest/active_support/testing/performance/rubinius.rb
|
129
|
+
- lib/rails/perftest/active_support/testing/performance/ruby.rb
|
130
|
+
- lib/rails/perftest/commands.rb
|
131
|
+
- lib/rails/perftest/commands/benchmarker.rb
|
132
|
+
- lib/rails/perftest/commands/profiler.rb
|
133
|
+
- lib/rails/perftest/railtie.rb
|
134
|
+
- lib/rails/perftest/railties/testing.tasks
|
135
|
+
- lib/rails/perftest/version.rb
|
136
|
+
- rails-perftest.gemspec
|
137
|
+
- rails-perftest.gemspec.erb
|
138
|
+
- test/generators/generators_test_helper.rb
|
139
|
+
- test/generators/performance_test_generator_test.rb
|
140
|
+
- test/helper.rb
|
141
|
+
- test/performance_test.rb
|
142
|
+
homepage: https://github.com/rails/rails-perftest
|
143
|
+
licenses: []
|
144
|
+
post_install_message:
|
145
|
+
rdoc_options: []
|
146
|
+
require_paths:
|
147
|
+
- lib
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
156
|
+
requirements:
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
requirements: []
|
161
|
+
rubyforge_project:
|
162
|
+
rubygems_version: 1.8.10
|
163
|
+
signing_key:
|
164
|
+
specification_version: 3
|
165
|
+
summary: ActionDispatch::PerformanceTest, ActiveSupport::Testing::Performance extracted
|
166
|
+
from Rails.
|
167
|
+
test_files:
|
168
|
+
- test/generators/generators_test_helper.rb
|
169
|
+
- test/generators/performance_test_generator_test.rb
|
170
|
+
- test/helper.rb
|
171
|
+
- test/performance_test.rb
|