test_server 0.2.4 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +3 -0
  3. data/Gemfile +54 -29
  4. data/README.rdoc +28 -0
  5. data/Rakefile +3 -3
  6. data/app/assets/images/.keep +0 -0
  7. data/app/assets/javascripts/application.js +14 -0
  8. data/app/assets/javascripts/errors.js +2 -0
  9. data/app/assets/stylesheets/application.scss +83 -0
  10. data/app/assets/stylesheets/errors.css +4 -0
  11. data/app/controllers/concerns/.keep +0 -0
  12. data/app/controllers/test_server/application_controller.rb +34 -0
  13. data/app/controllers/test_server/dashboard_controller.rb +9 -0
  14. data/app/controllers/test_server/errors_controller.rb +22 -0
  15. data/app/controllers/test_server/generator_controller.rb +40 -0
  16. data/app/controllers/test_server/static_controller.rb +16 -0
  17. data/app/controllers/test_server/streaming_controller.rb +56 -0
  18. data/app/controllers/test_server/string_controller.rb +39 -0
  19. data/app/helpers/application_helper.rb +2 -0
  20. data/app/helpers/errors_helper.rb +2 -0
  21. data/app/mailers/.keep +0 -0
  22. data/app/models/.keep +0 -0
  23. data/app/models/concerns/.keep +0 -0
  24. data/app/views/layouts/application.html.haml +59 -0
  25. data/app/views/shared/_overview.html.haml +16 -0
  26. data/app/views/test_server/dashboard/show.html.haml +7 -0
  27. data/app/views/test_server/errors/not_found.html.haml +2 -0
  28. data/app/views/test_server/errors/show.html.haml +6 -0
  29. data/app/views/test_server/generator/_overview.html.haml +1 -0
  30. data/app/views/test_server/generator/index.html.haml +1 -0
  31. data/app/views/{xhr/show.haml → test_server/generator/xhr.html.haml} +15 -12
  32. data/app/views/test_server/static/_overview.html.haml +1 -0
  33. data/app/views/test_server/static/index.html.haml +1 -0
  34. data/app/views/test_server/streaming/_overview.html.haml +1 -0
  35. data/app/views/test_server/streaming/index.html.haml +1 -0
  36. data/app/views/test_server/string/_overview.html.haml +1 -0
  37. data/app/views/test_server/string/index.html.haml +1 -0
  38. data/config.ru +3 -50
  39. data/config/application.rb +44 -0
  40. data/config/boot.rb +4 -0
  41. data/config/database.yml +25 -0
  42. data/config/environment.rb +5 -0
  43. data/config/environments/development.rb +37 -0
  44. data/config/environments/production.rb +87 -0
  45. data/config/environments/profile.rb +85 -0
  46. data/config/environments/test.rb +39 -0
  47. data/config/initializers/backtrace_silencers.rb +7 -0
  48. data/config/initializers/breadbrumb_builder.rb +24 -0
  49. data/config/initializers/change_values.rb +5 -0
  50. data/config/initializers/cookies_serializer.rb +3 -0
  51. data/config/initializers/filter_parameter_logging.rb +4 -0
  52. data/config/initializers/inflections.rb +16 -0
  53. data/config/initializers/mime_types.rb +4 -0
  54. data/config/initializers/session_store.rb +3 -0
  55. data/config/initializers/to_bool.rb +23 -0
  56. data/config/initializers/wrap_parameters.rb +14 -0
  57. data/config/locales/en.yml +23 -0
  58. data/config/routes.rb +78 -0
  59. data/config/secrets.yml +22 -0
  60. data/lib/assets/.keep +0 -0
  61. data/lib/tasks/.keep +0 -0
  62. data/lib/test_server.rb +13 -15
  63. data/lib/test_server/error_handler.rb +15 -11
  64. data/lib/test_server/error_messages.rb +16 -6
  65. data/lib/test_server/exceptions.rb +6 -0
  66. data/lib/test_server/locales/en.yml +55 -2
  67. data/lib/test_server/permitted_params.rb +107 -0
  68. data/lib/test_server/version.rb +1 -1
  69. data/lib/test_server/web_helper.rb +7 -31
  70. data/log/.keep +0 -0
  71. data/log/development.log +0 -0
  72. data/log/test.log +1 -0
  73. data/public/404.html +67 -0
  74. data/public/422.html +67 -0
  75. data/public/500.html +66 -0
  76. data/public/favicon.ico +0 -0
  77. data/public/robots.txt +5 -0
  78. data/public/static/plain.html +11 -0
  79. data/script/bundle +3 -0
  80. data/script/rails +8 -0
  81. data/script/rake +8 -0
  82. data/script/spring +18 -0
  83. data/spec/controllers/errors_controller_spec.rb +12 -0
  84. data/spec/error_handler_spec.rb +42 -9
  85. data/spec/features/dashboard_spec.rb +35 -0
  86. data/spec/features/fetch_data_via_javascript_spec.rb +14 -14
  87. data/spec/features/fetch_test_data_plain_spec.rb +11 -29
  88. data/spec/features/fetch_test_data_via_streaming_spec.rb +6 -6
  89. data/spec/features/helper_spec.rb +23 -31
  90. data/spec/helpers/errors_helper_spec.rb +15 -0
  91. data/spec/permitted_params_spec.rb +64 -0
  92. data/spec/spec_helper.rb +44 -3
  93. data/spec/support/capybara.rb +4 -0
  94. data/spec/support/rails.rb +33 -0
  95. data/spec/views/errors/not_found.html.haml_spec.rb +5 -0
  96. data/test_server.gemspec +18 -17
  97. data/vendor/assets/components/open-sans/scss/_base.scss +5 -5
  98. data/vendor/assets/javascripts/.keep +0 -0
  99. data/vendor/assets/stylesheets/.keep +0 -0
  100. metadata +133 -116
  101. data/app/controllers/application_controller.rb +0 -76
  102. data/app/controllers/assets_controller.rb +0 -73
  103. data/app/controllers/javascript_controller.rb +0 -36
  104. data/app/controllers/streaming_controller.rb +0 -52
  105. data/app/controllers/string_controller.rb +0 -51
  106. data/app/views/layouts/application.haml +0 -19
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OTkzNTA4ZmUzMGIyMzAwMDQyYjAxZDQ4ZGM4YTJhNWVhNjEyOWY2Yw==
5
+ data.tar.gz: !binary |-
6
+ ZTAzZDVjZmM5ZmFmYTI4ZjYwZDQwNDRmMTY1MTBjZGFjOTk5YTFhZQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NTEzYWM3ZDYzYzA4ODljMmJjZDZiMDlhOGFiYWY0ZGU1ODY2NDI3MGU3ZjA5
10
+ ZjE3NDI0NWU2ZWExMmJiY2I1YzU1ZTJhOGQxODBhYjAwMGNkOGFjOGI2NDll
11
+ ZDE2OTFmMWY3M2M4MDY2M2EzNjc2OGY3ZGFlMDEyM2E5NjUyMjU=
12
+ data.tar.gz: !binary |-
13
+ NWVhN2FiMTkyZTdhMjA3Njc0OWNhZjBiYzY5ZDQ4NmUxNmQzMmYzMjE1NTcy
14
+ NjJjMjU1M2EyMTgwMjZjYzNlOWQwNWRmMGUwYzY0ZDZlMjc3NjFjZDNlMjJl
15
+ M2I5NzUxNzExZDdiMGUyYjkyZWY2NDM0MzlhNGYxYjk2ZWUwMGI=
data/.gitignore CHANGED
@@ -17,3 +17,6 @@ test/version_tmp
17
17
  tmp
18
18
  *.xz
19
19
  PKGBUILD
20
+ db/*
21
+ !db/migrations
22
+ public/assets
data/Gemfile CHANGED
@@ -1,52 +1,77 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in test_server.gemspec
3
+ gem 'addressable'
4
+ gem 'bcrypt', '~> 3.1.7'
5
+ gem 'coffee-rails', '~> 4.0.0'
6
+ gem 'compass', '~>0.12.4'
7
+ gem 'haml', '~>4.0.0'
8
+ gem 'haml-rails'
9
+ gem 'i18n'
10
+ gem 'rails-i18n'
11
+ gem 'jbuilder', '~> 2.0'
12
+ gem 'jquery-rails'
13
+ gem 'pager'
14
+ gem 'rack-contrib'
15
+ gem 'rack-cors'
16
+ gem 'rails', '4.1.0'
17
+ gem 'sass-rails', '~> 4.0.3'
18
+ gem 'sqlite3'
19
+ gem 'therubyracer'
20
+ gem 'thor'
21
+ gem 'turbolinks'
22
+ gem 'uglifier', '>= 1.3.0'
23
+ gem 'breadcrumbs_on_rails'
24
+
4
25
  gemspec
5
26
 
6
- group :test do
7
- gem 'capybara', require: 'capybara/rspec'
8
- gem 'poltergeist', require: 'capybara/poltergeist'
9
- gem 'rack-test', require: 'rack/test'
10
- gem 'rspec', require: false
11
- gem 'fuubar', require: false
12
- gem 'simplecov', require: false
13
- gem 'rubocop', require: false
14
- gem 'coveralls', require: false
15
- gem 'cucumber', require: false
16
- gem 'aruba', require: false
17
- gem 'excon'
27
+ group :doc do
28
+ gem 'sdoc', '~> 0.4.0'
18
29
  end
19
30
 
20
31
  group :development do
21
- gem 'debugger'
22
- gem 'debugger-completion'
23
32
  gem 'foreman', require: false
24
33
  gem 'github-markup'
25
- gem 'pry'
26
- gem 'pry-debugger', require: false
27
- gem 'pry-doc', require: false
28
34
  gem 'redcarpet', require: false
29
35
  gem 'tmrb', require: false
30
36
  gem 'yard', require: false
31
37
  gem 'inch', require: false
32
38
  gem 'filegen'
39
+ gem 'spring'
33
40
  end
34
41
 
35
42
  group :profile do
36
43
  gem 'ruby-prof'
37
44
  end
38
45
 
39
- gem 'rake', group: [:development, :test], require: false
40
- gem 'fedux_org-stdlib', group: [:development, :test], require: false
41
- gem 'bundler', '~> 1.3', group: [:development, :test], require: false
42
- gem 'erubis', group: [:development, :test]
43
- gem 'versionomy', group: [:development, :test], require: false
44
- gem 'activesupport', '~> 4.0.0', group: [:development, :test], require: false
45
- gem 'launchy', group: [:development, :test]
46
- gem 'nokogiri', group: [:development, :test]
47
- gem 'shotgun', group: [:development, :test]
48
-
49
- gem 'awesome_print', group: [:development, :test], require: 'ap'
46
+ group :development, :test do
47
+ gem 'aruba', require: false
48
+ gem 'bundler', '~> 1.3', require: false
49
+ gem 'capybara', require: false
50
+ gem 'coveralls', require: false
51
+ gem 'cucumber', require: false
52
+ gem 'debugger'
53
+ gem 'debugger-completion'
54
+ gem 'erubis'
55
+ gem 'excon'
56
+ gem 'fedux_org-stdlib', require: false
57
+ gem 'fuubar', require: false
58
+ gem 'launchy'
59
+ gem 'nokogiri'
60
+ gem 'poltergeist', require: 'capybara/poltergeist'
61
+ gem 'pry'
62
+ gem 'pry-debugger', require: false
63
+ gem 'pry-doc', require: false
64
+ gem 'rack-test', require: 'rack/test'
65
+ gem 'rake', require: false
66
+ gem 'rspec', require: false
67
+ gem 'rspec-rails', '~> 2.0'
68
+ gem 'rubocop', require: false
69
+ gem 'shotgun'
70
+ gem 'simplecov', require: false
71
+ gem 'versionomy', require: false
72
+ gem 'awesome_print', require: 'ap'
73
+ end
74
+
50
75
 
51
76
  group :webserver do
52
77
  group :puma do
data/README.rdoc ADDED
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
data/Rakefile CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env rake
2
2
 
3
- #require 'bundler'
4
- #Bundler.require :default, :test, :development
5
-
6
3
  require 'filegen'
7
4
  require 'fedux_org/stdlib/rake'
8
5
  require 'active_support/core_ext/string/inflections'
9
6
  require 'open3'
10
7
 
8
+ require File.expand_path('../config/application', __FILE__)
9
+ Rails.application.load_tasks
10
+
11
11
  def software
12
12
  gemspec.name
13
13
  end
File without changes
@@ -1,4 +1,18 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
1
13
  //= require jquery
14
+ //= require jquery_ujs
15
+ //= require turbolinks
2
16
  //= require bootstrap-sass/dist/js/bootstrap
3
17
 
4
18
  function escapeHTML(s) {
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -1,3 +1,18 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_self
14
+ */
15
+
1
16
  $icon-font-path: '/assets/bootstrap-sass/fonts/';
2
17
  $open-sans-path: '/assets/open-sans/fonts';
3
18
 
@@ -10,10 +25,23 @@ html, body {
10
25
  }
11
26
 
12
27
  h1 {
28
+ font-family: 'Open Sans', 'sans-serif';
13
29
  font-weight: bold;
14
30
  font-size: 4rem;
15
31
  }
16
32
 
33
+ h2 {
34
+ font-family: 'Open Sans', 'sans-serif';
35
+ }
36
+
37
+ h3 {
38
+ font-family: 'Open Sans', 'sans-serif';
39
+ }
40
+
41
+ h4 {
42
+ font-family: 'Open Sans', 'sans-serif';
43
+ }
44
+
17
45
  .ts-page-footer {
18
46
  position: absolute;
19
47
  bottom: 5px;
@@ -54,6 +82,8 @@ h1 {
54
82
  }
55
83
 
56
84
  .ts-container {
85
+ margin: 20px;
86
+ vertical-align: top;
57
87
  }
58
88
 
59
89
  .ts-navigation {
@@ -172,3 +202,56 @@ a:focus {
172
202
  .ts-inline {
173
203
  display: inline;
174
204
  }
205
+
206
+ .ts-dashboard-section {
207
+ @extend .panel;
208
+ @extend .panel-default;
209
+ min-width: 300px;
210
+ max-width: 350px;
211
+ min-height: 150px;
212
+ width: 30%;
213
+ vertical-align: top;
214
+ display: inline-block;
215
+ }
216
+
217
+ .ts-dashboard-section-body {
218
+ @extend .panel-body;
219
+ margin-left: 20px;
220
+ margin-right: 20px;
221
+ }
222
+
223
+ .ts-dashboard-section-header {
224
+ @extend .panel-heading;
225
+ }
226
+
227
+ .ts-dashboard-section-title {
228
+ @extend .panel-title;
229
+ }
230
+
231
+ .ts-dashboard-section-list {
232
+ }
233
+
234
+ .ts-dashboard-known_params {
235
+ color: grey;
236
+ font-size: 1.2rem;
237
+ }
238
+
239
+ .ts-dropdown-menu {
240
+ @extend .dropdown-menu;
241
+ }
242
+
243
+ .ts-dropdown {
244
+ @extend .dropdown;
245
+ }
246
+
247
+ .ts-dropdown-toggle {
248
+ @extend .dropdown-toggle;
249
+ }
250
+
251
+ .ts-caret {
252
+ @extend .caret;
253
+ }
254
+
255
+ .ts-breadcrumb {
256
+ @extend .breadcrumb;
257
+ }
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
File without changes
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+ module TestServer
3
+ class ApplicationController < ActionController::Base
4
+ layout 'application'
5
+
6
+ include TestServer::WebHelper
7
+
8
+ # Prevent CSRF attacks by raising an exception.
9
+ # For APIs, you may want to use :null_session instead.
10
+ protect_from_forgery with: :exception
11
+
12
+ before_filter :configure_caching
13
+ before_filter :set_params
14
+
15
+ private
16
+
17
+ def permitted_params
18
+ @permitted_params ||= PermittedParams.new(params)
19
+ end
20
+
21
+ def set_params
22
+ self.params = permitted_params.params_for_controller controller_name, action_name, default_params
23
+ end
24
+
25
+ helper_method :permitted_params
26
+
27
+ def default_params
28
+ {
29
+ base64: false,
30
+ gzip: false,
31
+ }
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+ module TestServer
3
+ class DashboardController < ApplicationController
4
+ add_breadcrumb I18n.t('views.root.link'), :root_path
5
+
6
+ def show
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+ module TestServer
3
+ class ErrorsController < ApplicationController
4
+ def show
5
+ handler = ErrorHandler.find(env['action_dispatch.exception'])
6
+
7
+ @error_summary = handler.summary(:html)
8
+ @error_details = handler.details(:html)
9
+
10
+ respond_to do |format|
11
+ format.html { render status: handler.status_code }
12
+ format.json { render json: handler.to_hash, status: handler.status_code }
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ def error_params
19
+ params.permit(:exception)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+ module TestServer
3
+ class GeneratorController < ApplicationController
4
+ add_breadcrumb I18n.t('views.root.link'), :root_path
5
+ add_breadcrumb I18n.t('views.generator.link'), :generator_path
6
+
7
+ def index
8
+ end
9
+
10
+ def xhr
11
+ add_breadcrumb I18n.t('views.generator.xhr.link'), :generator_xhr_path
12
+
13
+ @urls = [ streaming_plain_url,
14
+ streaming_eicar_url,
15
+ streaming_random_url,
16
+ string_plain_url,
17
+ string_eicar_url,
18
+ string_sleep_url,
19
+ string_random_url,
20
+ generator_xhr_url,
21
+ "http://#{request.host_with_port}/static/plain.html"
22
+ ]
23
+
24
+ @count = params[:count]
25
+ @url = params[:url]
26
+ @timeout = params[:timeout]
27
+ @repeat = params[:repeat]
28
+ end
29
+
30
+ private
31
+
32
+ def default_params
33
+ {
34
+ count: 10,
35
+ timeout: 1_000,
36
+ repeat: 'false',
37
+ }
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ module TestServer
3
+ class StaticController < ApplicationController
4
+
5
+ def index
6
+ add_breadcrumb I18n.t('views.root.link'), :root_path
7
+ add_breadcrumb I18n.t('views.static.link'), :static_path
8
+ end
9
+
10
+ private
11
+
12
+ def default_roles
13
+ []
14
+ end
15
+ end
16
+ end