chillout 0.6.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.travis.yml +45 -9
- data/CHANGELOG.md +14 -0
- data/Gemfile +8 -0
- data/README.md +43 -7
- data/Rakefile +17 -2
- data/chillout.gemspec +21 -10
- data/lib/chillout/client.rb +26 -5
- data/lib/chillout/config.rb +15 -0
- data/lib/chillout/creation_listener.rb +10 -5
- data/lib/chillout/custom_metric.rb +27 -0
- data/lib/chillout/integrations/sidekiq.rb +22 -0
- data/lib/chillout/job.rb +12 -0
- data/lib/chillout/listener_injector.rb +23 -0
- data/lib/chillout/middleware/creations_monitor.rb +1 -1
- data/lib/chillout/middleware/sidekiq.rb +21 -0
- data/lib/chillout/railtie.rb +12 -14
- data/lib/chillout/server_side/dispatcher.rb +1 -1
- data/lib/chillout/server_side/plain_http_client.rb +22 -2
- data/lib/chillout/version.rb +1 -1
- data/lib/chillout/worker.rb +5 -5
- data/lib/chillout.rb +11 -0
- data/test/acceptance/client_sends_metrics_test.rb +21 -0
- data/test/acceptance/sidekiq_workers_send_metrics_test.rb +22 -0
- data/test/config_test.rb +31 -1
- data/test/custom_metric_test.rb +15 -0
- data/test/event_data_builder_test.rb +47 -41
- data/test/integration/client_test.rb +78 -4
- data/test/integration/worker_test.rb +3 -2
- data/test/middleware/creations_monitor_test.rb +28 -29
- data/test/middleware/sidekiq_test.rb +45 -0
- data/test/plain_http_client_test.rb +13 -0
- data/test/support/rails_3_2_13/Gemfile +5 -0
- data/test/support/rails_3_2_13/Rakefile +7 -0
- data/test/support/rails_3_2_13/app/controllers/application_controller.rb +3 -0
- data/test/support/rails_3_2_13/app/controllers/entities_controller.rb +70 -0
- data/test/support/rails_3_2_13/app/helpers/application_helper.rb +2 -0
- data/test/support/rails_3_2_13/app/models/entity.rb +3 -0
- data/test/support/rails_3_2_13/app/views/entities/_form.html.erb +21 -0
- data/test/support/rails_3_2_13/app/views/entities/edit.html.erb +6 -0
- data/test/support/rails_3_2_13/app/views/entities/index.html.erb +23 -0
- data/test/support/rails_3_2_13/app/views/entities/new.html.erb +5 -0
- data/test/support/rails_3_2_13/app/views/entities/show.html.erb +10 -0
- data/test/support/rails_3_2_13/app/views/layouts/application.html.erb +14 -0
- data/test/support/rails_3_2_13/config/application.rb +63 -0
- data/test/support/rails_3_2_13/config/boot.rb +6 -0
- data/test/support/rails_3_2_13/config/database.yml +11 -0
- data/test/support/rails_3_2_13/config/environment.rb +5 -0
- data/test/support/rails_3_2_13/config/environments/development.rb +32 -0
- data/test/support/rails_3_2_13/config/environments/production.rb +56 -0
- data/test/support/rails_3_2_13/config/environments/test.rb +37 -0
- data/test/support/rails_3_2_13/config/initializers/backtrace_silencers.rb +7 -0
- data/test/support/rails_3_2_13/config/initializers/inflections.rb +15 -0
- data/test/support/rails_3_2_13/config/initializers/load_schema.rb +4 -0
- data/test/support/rails_3_2_13/config/initializers/mime_types.rb +5 -0
- data/test/support/rails_3_2_13/config/initializers/secret_token.rb +7 -0
- data/test/support/rails_3_2_13/config/initializers/session_store.rb +8 -0
- data/test/support/rails_3_2_13/config/initializers/wrap_parameters.rb +14 -0
- data/test/support/rails_3_2_13/config/locales/en.yml +5 -0
- data/test/support/rails_3_2_13/config/routes.rb +3 -0
- data/test/support/rails_3_2_13/config.ru +4 -0
- data/test/support/rails_3_2_13/db/schema.rb +22 -0
- data/test/support/rails_3_2_13/public/404.html +26 -0
- data/test/support/rails_3_2_13/public/422.html +26 -0
- data/test/support/rails_3_2_13/public/500.html +25 -0
- data/test/support/rails_3_2_13/public/favicon.ico +0 -0
- data/test/support/rails_3_2_13/public/robots.txt +5 -0
- data/test/support/rails_3_2_13/script/rails +6 -0
- data/test/support/rails_4_0_0/Gemfile +5 -0
- data/test/support/rails_4_0_0/Rakefile +6 -0
- data/test/support/rails_4_0_0/app/controllers/application_controller.rb +5 -0
- data/test/support/rails_4_0_0/app/controllers/concerns/.keep +0 -0
- data/test/support/rails_4_0_0/app/controllers/entities_controller.rb +70 -0
- data/test/support/rails_4_0_0/app/helpers/application_helper.rb +2 -0
- data/test/support/rails_4_0_0/app/models/.keep +0 -0
- data/test/support/rails_4_0_0/app/models/concerns/.keep +0 -0
- data/test/support/rails_4_0_0/app/models/entity.rb +2 -0
- data/test/support/rails_4_0_0/app/views/entities/_form.html.erb +21 -0
- data/test/support/rails_4_0_0/app/views/entities/edit.html.erb +6 -0
- data/test/support/rails_4_0_0/app/views/entities/index.html.erb +23 -0
- data/test/support/rails_4_0_0/app/views/entities/new.html.erb +5 -0
- data/test/support/rails_4_0_0/app/views/entities/show.html.erb +10 -0
- data/test/support/rails_4_0_0/app/views/layouts/application.html.erb +14 -0
- data/test/support/rails_4_0_0/config/application.rb +31 -0
- data/test/support/rails_4_0_0/config/boot.rb +4 -0
- data/test/support/rails_4_0_0/config/database.yml +11 -0
- data/test/support/rails_4_0_0/config/environment.rb +5 -0
- data/test/support/rails_4_0_0/config/environments/development.rb +25 -0
- data/test/support/rails_4_0_0/config/environments/production.rb +67 -0
- data/test/support/rails_4_0_0/config/environments/test.rb +36 -0
- data/test/support/rails_4_0_0/config/initializers/backtrace_silencers.rb +7 -0
- data/test/support/rails_4_0_0/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/support/rails_4_0_0/config/initializers/inflections.rb +16 -0
- data/test/support/rails_4_0_0/config/initializers/load_schema.rb +4 -0
- data/test/support/rails_4_0_0/config/initializers/mime_types.rb +5 -0
- data/test/support/rails_4_0_0/config/initializers/secret_token.rb +12 -0
- data/test/support/rails_4_0_0/config/initializers/session_store.rb +3 -0
- data/test/support/rails_4_0_0/config/initializers/wrap_parameters.rb +14 -0
- data/test/support/rails_4_0_0/config/locales/en.yml +23 -0
- data/test/support/rails_4_0_0/config/routes.rb +3 -0
- data/test/support/rails_4_0_0/config.ru +4 -0
- data/test/support/rails_4_0_0/db/schema.rb +22 -0
- data/test/support/rails_4_0_0/lib/assets/.keep +0 -0
- data/test/support/rails_4_0_0/lib/tasks/.keep +0 -0
- data/test/support/rails_4_0_0/public/404.html +58 -0
- data/test/support/rails_4_0_0/public/422.html +58 -0
- data/test/support/rails_4_0_0/public/500.html +57 -0
- data/test/support/rails_4_0_0/public/favicon.ico +0 -0
- data/test/support/rails_4_0_0/public/robots.txt +5 -0
- data/test/support/rails_4_0_0/script/bundle +3 -0
- data/test/support/rails_4_0_0/script/rails +4 -0
- data/test/support/rails_4_0_0/script/rake +4 -0
- data/test/support/rails_4_0_13/Gemfile +5 -0
- data/test/support/rails_4_0_13/Rakefile +6 -0
- data/test/support/rails_4_0_13/app/controllers/application_controller.rb +5 -0
- data/test/support/rails_4_0_13/app/controllers/concerns/.keep +0 -0
- data/test/support/rails_4_0_13/app/controllers/entities_controller.rb +70 -0
- data/test/support/rails_4_0_13/app/helpers/application_helper.rb +2 -0
- data/test/support/rails_4_0_13/app/models/.keep +0 -0
- data/test/support/rails_4_0_13/app/models/concerns/.keep +0 -0
- data/test/support/rails_4_0_13/app/models/entity.rb +2 -0
- data/test/support/rails_4_0_13/app/views/entities/_form.html.erb +21 -0
- data/test/support/rails_4_0_13/app/views/entities/edit.html.erb +6 -0
- data/test/support/rails_4_0_13/app/views/entities/index.html.erb +23 -0
- data/test/support/rails_4_0_13/app/views/entities/new.html.erb +5 -0
- data/test/support/rails_4_0_13/app/views/entities/show.html.erb +10 -0
- data/test/support/rails_4_0_13/app/views/layouts/application.html.erb +14 -0
- data/test/support/rails_4_0_13/config/application.rb +31 -0
- data/test/support/rails_4_0_13/config/boot.rb +4 -0
- data/test/support/rails_4_0_13/config/database.yml +11 -0
- data/test/support/rails_4_0_13/config/environment.rb +5 -0
- data/test/support/rails_4_0_13/config/environments/development.rb +25 -0
- data/test/support/rails_4_0_13/config/environments/production.rb +67 -0
- data/test/support/rails_4_0_13/config/environments/test.rb +36 -0
- data/test/support/rails_4_0_13/config/initializers/backtrace_silencers.rb +7 -0
- data/test/support/rails_4_0_13/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/support/rails_4_0_13/config/initializers/inflections.rb +16 -0
- data/test/support/rails_4_0_13/config/initializers/load_schema.rb +4 -0
- data/test/support/rails_4_0_13/config/initializers/mime_types.rb +5 -0
- data/test/support/rails_4_0_13/config/initializers/secret_token.rb +12 -0
- data/test/support/rails_4_0_13/config/initializers/session_store.rb +3 -0
- data/test/support/rails_4_0_13/config/initializers/wrap_parameters.rb +14 -0
- data/test/support/rails_4_0_13/config/locales/en.yml +23 -0
- data/test/support/rails_4_0_13/config/routes.rb +3 -0
- data/test/support/rails_4_0_13/config.ru +4 -0
- data/test/support/rails_4_0_13/db/schema.rb +22 -0
- data/test/support/rails_4_0_13/lib/assets/.keep +0 -0
- data/test/support/rails_4_0_13/lib/tasks/.keep +0 -0
- data/test/support/rails_4_0_13/public/404.html +58 -0
- data/test/support/rails_4_0_13/public/422.html +58 -0
- data/test/support/rails_4_0_13/public/500.html +57 -0
- data/test/support/rails_4_0_13/public/favicon.ico +0 -0
- data/test/support/rails_4_0_13/public/robots.txt +5 -0
- data/test/support/rails_4_0_13/script/bundle +3 -0
- data/test/support/rails_4_0_13/script/rails +4 -0
- data/test/support/rails_4_0_13/script/rake +4 -0
- data/test/support/rails_4_1_0/Gemfile +5 -0
- data/test/support/rails_4_1_0/Rakefile +6 -0
- data/test/support/rails_4_1_0/app/controllers/application_controller.rb +5 -0
- data/test/support/rails_4_1_0/app/controllers/concerns/.keep +0 -0
- data/test/support/rails_4_1_0/app/controllers/entities_controller.rb +70 -0
- data/test/support/rails_4_1_0/app/helpers/application_helper.rb +2 -0
- data/test/support/rails_4_1_0/app/models/.keep +0 -0
- data/test/support/rails_4_1_0/app/models/concerns/.keep +0 -0
- data/test/support/rails_4_1_0/app/models/entity.rb +2 -0
- data/test/support/rails_4_1_0/app/views/entities/_form.html.erb +21 -0
- data/test/support/rails_4_1_0/app/views/entities/edit.html.erb +6 -0
- data/test/support/rails_4_1_0/app/views/entities/index.html.erb +23 -0
- data/test/support/rails_4_1_0/app/views/entities/new.html.erb +5 -0
- data/test/support/rails_4_1_0/app/views/entities/show.html.erb +10 -0
- data/test/support/rails_4_1_0/app/views/layouts/application.html.erb +14 -0
- data/test/support/rails_4_1_0/config/application.rb +31 -0
- data/test/support/rails_4_1_0/config/boot.rb +4 -0
- data/test/support/rails_4_1_0/config/database.yml +11 -0
- data/test/support/rails_4_1_0/config/environment.rb +5 -0
- data/test/support/rails_4_1_0/config/environments/development.rb +25 -0
- data/test/support/rails_4_1_0/config/environments/production.rb +67 -0
- data/test/support/rails_4_1_0/config/environments/test.rb +36 -0
- data/test/support/rails_4_1_0/config/initializers/backtrace_silencers.rb +7 -0
- data/test/support/rails_4_1_0/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/support/rails_4_1_0/config/initializers/inflections.rb +16 -0
- data/test/support/rails_4_1_0/config/initializers/load_schema.rb +4 -0
- data/test/support/rails_4_1_0/config/initializers/mime_types.rb +5 -0
- data/test/support/rails_4_1_0/config/initializers/secret_token.rb +12 -0
- data/test/support/rails_4_1_0/config/initializers/session_store.rb +3 -0
- data/test/support/rails_4_1_0/config/initializers/wrap_parameters.rb +14 -0
- data/test/support/rails_4_1_0/config/locales/en.yml +23 -0
- data/test/support/rails_4_1_0/config/routes.rb +3 -0
- data/test/support/rails_4_1_0/config.ru +4 -0
- data/test/support/rails_4_1_0/db/schema.rb +22 -0
- data/test/support/rails_4_1_0/lib/assets/.keep +0 -0
- data/test/support/rails_4_1_0/lib/tasks/.keep +0 -0
- data/test/support/rails_4_1_0/public/404.html +58 -0
- data/test/support/rails_4_1_0/public/422.html +58 -0
- data/test/support/rails_4_1_0/public/500.html +57 -0
- data/test/support/rails_4_1_0/public/favicon.ico +0 -0
- data/test/support/rails_4_1_0/public/robots.txt +5 -0
- data/test/support/rails_4_1_0/script/bundle +3 -0
- data/test/support/rails_4_1_0/script/rails +4 -0
- data/test/support/rails_4_1_0/script/rake +4 -0
- data/test/support/rails_4_1_16/Gemfile +5 -0
- data/test/support/rails_4_1_16/Rakefile +6 -0
- data/test/support/rails_4_1_16/app/controllers/application_controller.rb +5 -0
- data/test/support/rails_4_1_16/app/controllers/concerns/.keep +0 -0
- data/test/support/rails_4_1_16/app/controllers/entities_controller.rb +70 -0
- data/test/support/rails_4_1_16/app/helpers/application_helper.rb +2 -0
- data/test/support/rails_4_1_16/app/models/.keep +0 -0
- data/test/support/rails_4_1_16/app/models/concerns/.keep +0 -0
- data/test/support/rails_4_1_16/app/models/entity.rb +2 -0
- data/test/support/rails_4_1_16/app/views/entities/_form.html.erb +21 -0
- data/test/support/rails_4_1_16/app/views/entities/edit.html.erb +6 -0
- data/test/support/rails_4_1_16/app/views/entities/index.html.erb +23 -0
- data/test/support/rails_4_1_16/app/views/entities/new.html.erb +5 -0
- data/test/support/rails_4_1_16/app/views/entities/show.html.erb +10 -0
- data/test/support/rails_4_1_16/app/views/layouts/application.html.erb +14 -0
- data/test/support/rails_4_1_16/config/application.rb +31 -0
- data/test/support/rails_4_1_16/config/boot.rb +4 -0
- data/test/support/rails_4_1_16/config/database.yml +11 -0
- data/test/support/rails_4_1_16/config/environment.rb +5 -0
- data/test/support/rails_4_1_16/config/environments/development.rb +25 -0
- data/test/support/rails_4_1_16/config/environments/production.rb +67 -0
- data/test/support/rails_4_1_16/config/environments/test.rb +36 -0
- data/test/support/rails_4_1_16/config/initializers/backtrace_silencers.rb +7 -0
- data/test/support/rails_4_1_16/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/support/rails_4_1_16/config/initializers/inflections.rb +16 -0
- data/test/support/rails_4_1_16/config/initializers/load_schema.rb +4 -0
- data/test/support/rails_4_1_16/config/initializers/mime_types.rb +5 -0
- data/test/support/rails_4_1_16/config/initializers/secret_token.rb +12 -0
- data/test/support/rails_4_1_16/config/initializers/session_store.rb +3 -0
- data/test/support/rails_4_1_16/config/initializers/wrap_parameters.rb +14 -0
- data/test/support/rails_4_1_16/config/locales/en.yml +23 -0
- data/test/support/rails_4_1_16/config/routes.rb +3 -0
- data/test/support/rails_4_1_16/config.ru +4 -0
- data/test/support/rails_4_1_16/db/schema.rb +22 -0
- data/test/support/rails_4_1_16/lib/assets/.keep +0 -0
- data/test/support/rails_4_1_16/lib/tasks/.keep +0 -0
- data/test/support/rails_4_1_16/public/404.html +58 -0
- data/test/support/rails_4_1_16/public/422.html +58 -0
- data/test/support/rails_4_1_16/public/500.html +57 -0
- data/test/support/rails_4_1_16/public/favicon.ico +0 -0
- data/test/support/rails_4_1_16/public/robots.txt +5 -0
- data/test/support/rails_4_1_16/script/bundle +3 -0
- data/test/support/rails_4_1_16/script/rails +4 -0
- data/test/support/rails_4_1_16/script/rake +4 -0
- data/test/support/rails_4_2_0/Gemfile +5 -0
- data/test/support/rails_4_2_0/Rakefile +6 -0
- data/test/support/rails_4_2_0/app/controllers/application_controller.rb +5 -0
- data/test/support/rails_4_2_0/app/controllers/concerns/.keep +0 -0
- data/test/support/rails_4_2_0/app/controllers/entities_controller.rb +70 -0
- data/test/support/rails_4_2_0/app/helpers/application_helper.rb +2 -0
- data/test/support/rails_4_2_0/app/models/.keep +0 -0
- data/test/support/rails_4_2_0/app/models/concerns/.keep +0 -0
- data/test/support/rails_4_2_0/app/models/entity.rb +2 -0
- data/test/support/rails_4_2_0/app/views/entities/_form.html.erb +21 -0
- data/test/support/rails_4_2_0/app/views/entities/edit.html.erb +6 -0
- data/test/support/rails_4_2_0/app/views/entities/index.html.erb +23 -0
- data/test/support/rails_4_2_0/app/views/entities/new.html.erb +5 -0
- data/test/support/rails_4_2_0/app/views/entities/show.html.erb +10 -0
- data/test/support/rails_4_2_0/app/views/layouts/application.html.erb +14 -0
- data/test/support/rails_4_2_0/config/application.rb +31 -0
- data/test/support/rails_4_2_0/config/boot.rb +4 -0
- data/test/support/rails_4_2_0/config/database.yml +11 -0
- data/test/support/rails_4_2_0/config/environment.rb +5 -0
- data/test/support/rails_4_2_0/config/environments/development.rb +25 -0
- data/test/support/rails_4_2_0/config/environments/production.rb +67 -0
- data/test/support/rails_4_2_0/config/environments/test.rb +36 -0
- data/test/support/rails_4_2_0/config/initializers/backtrace_silencers.rb +7 -0
- data/test/support/rails_4_2_0/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/support/rails_4_2_0/config/initializers/inflections.rb +16 -0
- data/test/support/rails_4_2_0/config/initializers/load_schema.rb +4 -0
- data/test/support/rails_4_2_0/config/initializers/mime_types.rb +5 -0
- data/test/support/rails_4_2_0/config/initializers/secret_token.rb +12 -0
- data/test/support/rails_4_2_0/config/initializers/session_store.rb +3 -0
- data/test/support/rails_4_2_0/config/initializers/wrap_parameters.rb +14 -0
- data/test/support/rails_4_2_0/config/locales/en.yml +23 -0
- data/test/support/rails_4_2_0/config/routes.rb +3 -0
- data/test/support/rails_4_2_0/config.ru +4 -0
- data/test/support/rails_4_2_0/db/schema.rb +22 -0
- data/test/support/rails_4_2_0/lib/assets/.keep +0 -0
- data/test/support/rails_4_2_0/lib/tasks/.keep +0 -0
- data/test/support/rails_4_2_0/public/404.html +58 -0
- data/test/support/rails_4_2_0/public/422.html +58 -0
- data/test/support/rails_4_2_0/public/500.html +57 -0
- data/test/support/rails_4_2_0/public/favicon.ico +0 -0
- data/test/support/rails_4_2_0/public/robots.txt +5 -0
- data/test/support/rails_4_2_0/script/bundle +3 -0
- data/test/support/rails_4_2_0/script/rails +4 -0
- data/test/support/rails_4_2_0/script/rake +4 -0
- data/test/support/rails_4_2_8/Gemfile +5 -0
- data/test/support/rails_4_2_8/Rakefile +6 -0
- data/test/support/rails_4_2_8/app/controllers/application_controller.rb +5 -0
- data/test/support/rails_4_2_8/app/controllers/concerns/.keep +0 -0
- data/test/support/rails_4_2_8/app/controllers/entities_controller.rb +70 -0
- data/test/support/rails_4_2_8/app/helpers/application_helper.rb +2 -0
- data/test/support/rails_4_2_8/app/models/.keep +0 -0
- data/test/support/rails_4_2_8/app/models/concerns/.keep +0 -0
- data/test/support/rails_4_2_8/app/models/entity.rb +2 -0
- data/test/support/rails_4_2_8/app/views/entities/_form.html.erb +21 -0
- data/test/support/rails_4_2_8/app/views/entities/edit.html.erb +6 -0
- data/test/support/rails_4_2_8/app/views/entities/index.html.erb +23 -0
- data/test/support/rails_4_2_8/app/views/entities/new.html.erb +5 -0
- data/test/support/rails_4_2_8/app/views/entities/show.html.erb +10 -0
- data/test/support/rails_4_2_8/app/views/layouts/application.html.erb +14 -0
- data/test/support/rails_4_2_8/config/application.rb +34 -0
- data/test/support/rails_4_2_8/config/boot.rb +4 -0
- data/test/support/rails_4_2_8/config/database.yml +11 -0
- data/test/support/rails_4_2_8/config/environment.rb +5 -0
- data/test/support/rails_4_2_8/config/environments/development.rb +25 -0
- data/test/support/rails_4_2_8/config/environments/production.rb +73 -0
- data/test/support/rails_4_2_8/config/environments/test.rb +36 -0
- data/test/support/rails_4_2_8/config/initializers/backtrace_silencers.rb +7 -0
- data/test/support/rails_4_2_8/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/support/rails_4_2_8/config/initializers/inflections.rb +16 -0
- data/test/support/rails_4_2_8/config/initializers/load_schema.rb +4 -0
- data/test/support/rails_4_2_8/config/initializers/mime_types.rb +5 -0
- data/test/support/rails_4_2_8/config/initializers/secret_token.rb +12 -0
- data/test/support/rails_4_2_8/config/initializers/session_store.rb +3 -0
- data/test/support/rails_4_2_8/config/initializers/wrap_parameters.rb +14 -0
- data/test/support/rails_4_2_8/config/locales/en.yml +23 -0
- data/test/support/rails_4_2_8/config/routes.rb +3 -0
- data/test/support/rails_4_2_8/config.ru +4 -0
- data/test/support/rails_4_2_8/db/schema.rb +22 -0
- data/test/support/rails_4_2_8/lib/assets/.keep +0 -0
- data/test/support/rails_4_2_8/lib/tasks/.keep +0 -0
- data/test/support/rails_4_2_8/public/404.html +58 -0
- data/test/support/rails_4_2_8/public/422.html +58 -0
- data/test/support/rails_4_2_8/public/500.html +57 -0
- data/test/support/rails_4_2_8/public/favicon.ico +0 -0
- data/test/support/rails_4_2_8/public/robots.txt +5 -0
- data/test/support/rails_4_2_8/script/bundle +3 -0
- data/test/support/rails_4_2_8/script/rails +4 -0
- data/test/support/rails_4_2_8/script/rake +4 -0
- data/test/support/rails_5_0_3/Gemfile +5 -0
- data/test/support/rails_5_0_3/Rakefile +6 -0
- data/test/support/rails_5_0_3/app/controllers/application_controller.rb +5 -0
- data/test/support/rails_5_0_3/app/controllers/concerns/.keep +0 -0
- data/test/support/rails_5_0_3/app/controllers/entities_controller.rb +70 -0
- data/test/support/rails_5_0_3/app/helpers/application_helper.rb +2 -0
- data/test/support/rails_5_0_3/app/models/.keep +0 -0
- data/test/support/rails_5_0_3/app/models/concerns/.keep +0 -0
- data/test/support/rails_5_0_3/app/models/entity.rb +2 -0
- data/test/support/rails_5_0_3/app/views/entities/_form.html.erb +21 -0
- data/test/support/rails_5_0_3/app/views/entities/edit.html.erb +6 -0
- data/test/support/rails_5_0_3/app/views/entities/index.html.erb +23 -0
- data/test/support/rails_5_0_3/app/views/entities/new.html.erb +5 -0
- data/test/support/rails_5_0_3/app/views/entities/show.html.erb +10 -0
- data/test/support/rails_5_0_3/app/views/layouts/application.html.erb +14 -0
- data/test/support/rails_5_0_3/config/application.rb +30 -0
- data/test/support/rails_5_0_3/config/boot.rb +4 -0
- data/test/support/rails_5_0_3/config/database.yml +11 -0
- data/test/support/rails_5_0_3/config/environment.rb +5 -0
- data/test/support/rails_5_0_3/config/environments/development.rb +25 -0
- data/test/support/rails_5_0_3/config/environments/production.rb +73 -0
- data/test/support/rails_5_0_3/config/environments/test.rb +36 -0
- data/test/support/rails_5_0_3/config/initializers/backtrace_silencers.rb +7 -0
- data/test/support/rails_5_0_3/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/support/rails_5_0_3/config/initializers/inflections.rb +16 -0
- data/test/support/rails_5_0_3/config/initializers/load_schema.rb +4 -0
- data/test/support/rails_5_0_3/config/initializers/mime_types.rb +5 -0
- data/test/support/rails_5_0_3/config/initializers/secret_token.rb +12 -0
- data/test/support/rails_5_0_3/config/initializers/session_store.rb +3 -0
- data/test/support/rails_5_0_3/config/initializers/wrap_parameters.rb +14 -0
- data/test/support/rails_5_0_3/config/locales/en.yml +23 -0
- data/test/support/rails_5_0_3/config/routes.rb +3 -0
- data/test/support/rails_5_0_3/config.ru +4 -0
- data/test/support/rails_5_0_3/db/schema.rb +22 -0
- data/test/support/rails_5_0_3/lib/assets/.keep +0 -0
- data/test/support/rails_5_0_3/lib/tasks/.keep +0 -0
- data/test/support/rails_5_0_3/public/404.html +58 -0
- data/test/support/rails_5_0_3/public/422.html +58 -0
- data/test/support/rails_5_0_3/public/500.html +57 -0
- data/test/support/rails_5_0_3/public/favicon.ico +0 -0
- data/test/support/rails_5_0_3/public/robots.txt +5 -0
- data/test/support/rails_5_0_3/script/bundle +3 -0
- data/test/support/rails_5_0_3/script/rails +4 -0
- data/test/support/rails_5_0_3/script/rake +4 -0
- data/test/support/rails_5_1_1/Gemfile +6 -0
- data/test/support/rails_5_1_1/Rakefile +6 -0
- data/test/support/rails_5_1_1/app/controllers/application_controller.rb +5 -0
- data/test/support/rails_5_1_1/app/controllers/concerns/.keep +0 -0
- data/test/support/rails_5_1_1/app/controllers/entities_controller.rb +70 -0
- data/test/support/rails_5_1_1/app/helpers/application_helper.rb +2 -0
- data/test/support/rails_5_1_1/app/jobs/create_entity_job.rb +6 -0
- data/test/support/rails_5_1_1/app/models/.keep +0 -0
- data/test/support/rails_5_1_1/app/models/concerns/.keep +0 -0
- data/test/support/rails_5_1_1/app/models/entity.rb +2 -0
- data/test/support/rails_5_1_1/app/views/entities/_form.html.erb +21 -0
- data/test/support/rails_5_1_1/app/views/entities/edit.html.erb +6 -0
- data/test/support/rails_5_1_1/app/views/entities/index.html.erb +23 -0
- data/test/support/rails_5_1_1/app/views/entities/new.html.erb +5 -0
- data/test/support/rails_5_1_1/app/views/entities/show.html.erb +10 -0
- data/test/support/rails_5_1_1/app/views/layouts/application.html.erb +14 -0
- data/test/support/rails_5_1_1/config/application.rb +30 -0
- data/test/support/rails_5_1_1/config/boot.rb +4 -0
- data/test/support/rails_5_1_1/config/database.yml +11 -0
- data/test/support/rails_5_1_1/config/environment.rb +5 -0
- data/test/support/rails_5_1_1/config/environments/development.rb +25 -0
- data/test/support/rails_5_1_1/config/environments/production.rb +73 -0
- data/test/support/rails_5_1_1/config/environments/test.rb +36 -0
- data/test/support/rails_5_1_1/config/initializers/backtrace_silencers.rb +7 -0
- data/test/support/rails_5_1_1/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/support/rails_5_1_1/config/initializers/inflections.rb +16 -0
- data/test/support/rails_5_1_1/config/initializers/load_schema.rb +4 -0
- data/test/support/rails_5_1_1/config/initializers/mime_types.rb +5 -0
- data/test/support/rails_5_1_1/config/initializers/secret_token.rb +12 -0
- data/test/support/rails_5_1_1/config/initializers/session_store.rb +3 -0
- data/test/support/rails_5_1_1/config/initializers/wrap_parameters.rb +14 -0
- data/test/support/rails_5_1_1/config/locales/en.yml +23 -0
- data/test/support/rails_5_1_1/config/routes.rb +3 -0
- data/test/support/rails_5_1_1/config.ru +4 -0
- data/test/support/rails_5_1_1/db/schema.rb +22 -0
- data/test/support/rails_5_1_1/lib/assets/.keep +0 -0
- data/test/support/rails_5_1_1/lib/tasks/.keep +0 -0
- data/test/support/rails_5_1_1/public/404.html +58 -0
- data/test/support/rails_5_1_1/public/422.html +58 -0
- data/test/support/rails_5_1_1/public/500.html +57 -0
- data/test/support/rails_5_1_1/public/favicon.ico +0 -0
- data/test/support/rails_5_1_1/public/robots.txt +5 -0
- data/test/support/rails_5_1_1/script/bundle +3 -0
- data/test/support/rails_5_1_1/script/rails +4 -0
- data/test/support/rails_5_1_1/script/rake +4 -0
- data/test/test_helper.rb +149 -11
- data/test/worker_test.rb +1 -1
- metadata +974 -143
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'sidekiq'
|
3
|
+
|
4
|
+
class SidekiqWorkersSendMetricsTest < AcceptanceTestCase
|
5
|
+
|
6
|
+
def test_sidekiq_worker_sends_metrics
|
7
|
+
test_sidekiq_worker = TestSidekiqServer.new
|
8
|
+
test_endpoint = TestEndpoint.new(port: 8081)
|
9
|
+
|
10
|
+
test_endpoint.listen
|
11
|
+
test_sidekiq_worker.boot(chillout_port: 8081)
|
12
|
+
test_sidekiq_worker.push_job
|
13
|
+
|
14
|
+
if ENV['STRATEGY'] != 'active_job'
|
15
|
+
assert test_endpoint.has_received_information_about_startup
|
16
|
+
end
|
17
|
+
assert test_endpoint.has_one_creation_for_entity_resource
|
18
|
+
ensure
|
19
|
+
test_sidekiq_worker.shutdown if test_sidekiq_worker
|
20
|
+
end
|
21
|
+
|
22
|
+
end if ENV['SIDEKIQ_SUPPORTED']
|
data/test/config_test.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'test_helper'
|
2
|
+
require 'minitest/stub_const'
|
2
3
|
|
3
4
|
class ConfigTest < ChilloutTestCase
|
4
5
|
|
@@ -23,4 +24,33 @@ class ConfigTest < ChilloutTestCase
|
|
23
24
|
assert_equal @config.api_key, @config.authentication_password
|
24
25
|
end
|
25
26
|
|
26
|
-
|
27
|
+
def test_default_strategy_is_thread
|
28
|
+
assert_equal :thread, @config.strategy
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_can_assign_thread
|
32
|
+
@config.strategy = "thread"
|
33
|
+
assert_equal :thread, @config.strategy
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_cannot_assing_bullshit
|
37
|
+
assert_raises(ArgumentError) do
|
38
|
+
@config.strategy = "bullshit"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_can_assign_active_job_strategy
|
43
|
+
Object.stub_remove_const(:ActiveJob) do
|
44
|
+
refute defined?(ActiveJob)
|
45
|
+
assert_raises(ArgumentError) do
|
46
|
+
@config.strategy = :active_job
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
Object.stub_const(:ActiveJob, :WhatEver) do
|
51
|
+
@config.strategy = :active_job
|
52
|
+
assert_equal :active_job, @config.strategy
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class CustomMetricTest < ChilloutTestCase
|
4
|
+
def setup
|
5
|
+
@creations_container = MiniTest::Mock.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_custom_creation
|
9
|
+
@creations_container.expect(:nil?, false, [])
|
10
|
+
@creations_container.expect(:increment!, nil, ['foo'])
|
11
|
+
@custom_metric = Chillout::CustomMetric.new(@creations_container)
|
12
|
+
@custom_metric.track('foo')
|
13
|
+
@creations_container.verify
|
14
|
+
end
|
15
|
+
end
|
@@ -4,7 +4,8 @@ require 'chillout/creations_container'
|
|
4
4
|
|
5
5
|
module Chillout
|
6
6
|
class EventDataBuilderTest < ChilloutTestCase
|
7
|
-
setup
|
7
|
+
def setup
|
8
|
+
super
|
8
9
|
@shell_env = { 'PATH' => '/bin:/usr/bin' }
|
9
10
|
@api_key = "s3cr3t"
|
10
11
|
|
@@ -18,46 +19,51 @@ module Chillout
|
|
18
19
|
@timestamp = Time.now.iso8601
|
19
20
|
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
22
|
+
def build_from_creations_container
|
23
|
+
@creations_container = CreationsContainer.new
|
24
|
+
5.times { @creations_container.increment!("User") }
|
25
|
+
3.times { @creations_container.increment!("Cart") }
|
26
|
+
8.times { @creations_container.increment!("CartItem") }
|
27
|
+
|
28
|
+
@event_data_builder = EventDataBuilder.new(@config)
|
29
|
+
@event_data = @event_data_builder.build_from_creations_container(@creations_container, @timestamp)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_metric_type
|
33
|
+
build_from_creations_container
|
34
|
+
assert_param :metric, "creations"
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_timestamp
|
38
|
+
build_from_creations_container
|
39
|
+
assert_param :timestamp, @timestamp
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_each_counter
|
43
|
+
build_from_creations_container
|
44
|
+
assert_creations :User, 5
|
45
|
+
assert_creations :Cart, 3
|
46
|
+
assert_creations :CartItem, 8
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_environment
|
50
|
+
build_from_creations_container
|
51
|
+
assert_content :environment, "development"
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_notifier_name
|
55
|
+
build_from_creations_container
|
56
|
+
assert_notifier :name, "chillout"
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_notifier_version
|
60
|
+
build_from_creations_container
|
61
|
+
assert_notifier :version, "0.1"
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_notifier_url
|
65
|
+
build_from_creations_container
|
66
|
+
assert_notifier :url, "http://github.com/arkency/chillout"
|
61
67
|
end
|
62
68
|
|
63
69
|
private
|
@@ -1,10 +1,15 @@
|
|
1
1
|
require 'test_helper'
|
2
|
+
require 'active_job'
|
3
|
+
require 'active_job/test_helper'
|
2
4
|
|
3
5
|
class ClientIntegrationTest < ChilloutTestCase
|
6
|
+
include ActiveJob::TestHelper
|
7
|
+
|
4
8
|
def test_check_api_connection_with_200_ok_response
|
5
9
|
@_api_key = "xyz123"
|
6
10
|
url = api_url("check")
|
7
|
-
stub_request(:get, url).
|
11
|
+
stub_request(:get, url).with(basic_auth: ['xyz123', 'xyz123']).
|
12
|
+
to_return(:body => "OK", :status => 200)
|
8
13
|
|
9
14
|
client = Chillout::Client.new(@_api_key)
|
10
15
|
check_result = client.check_api_connection
|
@@ -14,7 +19,8 @@ class ClientIntegrationTest < ChilloutTestCase
|
|
14
19
|
def test_check_api_connection_with_other_response
|
15
20
|
@_api_key = "xyz123"
|
16
21
|
url = api_url("check")
|
17
|
-
stub_request(:get, url).
|
22
|
+
stub_request(:get, url).with(basic_auth: ['xyz123', 'xyz123']).
|
23
|
+
to_return(:body => "Not Found", :status => 404)
|
18
24
|
|
19
25
|
client = Chillout::Client.new(@_api_key)
|
20
26
|
check_result = client.check_api_connection
|
@@ -24,10 +30,78 @@ class ClientIntegrationTest < ChilloutTestCase
|
|
24
30
|
def test_check_api_connection_with_raised_exception_on_request
|
25
31
|
@_api_key = "xyz123"
|
26
32
|
url = api_url("check")
|
27
|
-
stub_request(:get, url).
|
33
|
+
stub_request(:get, url).with(basic_auth: ['xyz123', 'xyz123']).
|
34
|
+
to_raise(StandardError)
|
28
35
|
|
29
36
|
client = Chillout::Client.new(@_api_key)
|
30
37
|
check_result = client.check_api_connection
|
31
38
|
refute check_result.successful?, "Check was successful"
|
32
39
|
end
|
33
|
-
|
40
|
+
|
41
|
+
def test_client_creats_new_worker_thread_after_exception
|
42
|
+
@_api_key = "xyz123"
|
43
|
+
stub_request(:post, api_url("clients")).with(basic_auth: ['xyz123', 'xyz123']).
|
44
|
+
to_return(:body => "OK", :status => 200)
|
45
|
+
stub_request(:post, api_url("metrics")).with(basic_auth: ['xyz123', 'xyz123']).
|
46
|
+
to_return(:body => "OK", :status => 200)
|
47
|
+
|
48
|
+
client = Chillout::Client.new(@_api_key)
|
49
|
+
client.enqueue(Chillout::CreationsContainer.new)
|
50
|
+
assert client.worker_running?
|
51
|
+
|
52
|
+
client.enqueue(nil)
|
53
|
+
sleep(6)
|
54
|
+
refute client.worker_running?
|
55
|
+
|
56
|
+
client.enqueue(Chillout::CreationsContainer.new)
|
57
|
+
assert client.worker_running?
|
58
|
+
|
59
|
+
client.enqueue(nil)
|
60
|
+
sleep(6)
|
61
|
+
refute client.worker_running?
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_active_job_queueing
|
65
|
+
assert_enqueued_jobs 0
|
66
|
+
client = Chillout::Client.new("xyz123", strategy: :active_job)
|
67
|
+
container = Chillout::CreationsContainer.new
|
68
|
+
container.increment!("User")
|
69
|
+
|
70
|
+
assert_enqueued_jobs 1, only: Chillout::Job, queue: "chillout" do
|
71
|
+
client.enqueue(container)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_active_job_performing
|
76
|
+
@_api_key = "xyz123"
|
77
|
+
stub_request(:post, api_url("metrics")).with(basic_auth: ['xyz123', 'xyz123']).
|
78
|
+
to_return(:body => "OK", :status => 200)
|
79
|
+
|
80
|
+
client = Chillout::Client.new("xyz123", strategy: :active_job)
|
81
|
+
container = Chillout::CreationsContainer.new
|
82
|
+
container.increment!("User")
|
83
|
+
|
84
|
+
perform_enqueued_jobs do
|
85
|
+
assert_performed_jobs 1, only: Chillout::Job do
|
86
|
+
client.enqueue(container)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def self.active_job_4_test_helper?
|
94
|
+
instance_method(:assert_performed_jobs).arity == 1 && instance_method(:assert_enqueued_jobs).arity == 1
|
95
|
+
end
|
96
|
+
|
97
|
+
if active_job_4_test_helper?
|
98
|
+
prepend(Module.new(){
|
99
|
+
def assert_performed_jobs(number, only: nil, &block)
|
100
|
+
super(number, &block)
|
101
|
+
end
|
102
|
+
def assert_enqueued_jobs(number, only: nil, queue: nil, &block)
|
103
|
+
super(number, &block)
|
104
|
+
end
|
105
|
+
})
|
106
|
+
end
|
107
|
+
end
|
@@ -15,7 +15,7 @@ class WorkerIntegrationTest < ChilloutTestCase
|
|
15
15
|
client = Chillout::Client.new(@_api_key, :logger => null_logger)
|
16
16
|
worker_check = Proc.new do
|
17
17
|
client.enqueue(Chillout::CreationsContainer.new)
|
18
|
-
|
18
|
+
client.worker_running? ? Process.exit!(0) : Process.exit!(28)
|
19
19
|
end
|
20
20
|
|
21
21
|
assert_successful_exit Process.fork(&worker_check)
|
@@ -23,8 +23,9 @@ class WorkerIntegrationTest < ChilloutTestCase
|
|
23
23
|
|
24
24
|
def test_worker_running_lazily
|
25
25
|
client = Chillout::Client.new(@_api_key, :logger => null_logger)
|
26
|
-
client.
|
26
|
+
assert !client.worker_running?
|
27
27
|
|
28
|
+
client.enqueue(Chillout::CreationsContainer.new)
|
28
29
|
assert client.worker_running?
|
29
30
|
end
|
30
31
|
|
@@ -3,47 +3,46 @@ require 'test_helper'
|
|
3
3
|
module Chillout
|
4
4
|
module Middleware
|
5
5
|
class CreationsMonitorTest < ChilloutTestCase
|
6
|
-
setup
|
6
|
+
def setup
|
7
7
|
@env = { 'HOST' => 'example.net' }
|
8
|
-
@logger = stub(:
|
9
|
-
@client = stub(:
|
8
|
+
@logger = stub(info: "", debug: "")
|
9
|
+
@client = stub(logger: @logger)
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
[200, env, ['hello']]
|
17
|
-
end
|
18
|
-
@middleware = CreationsMonitor.new(@app, @client)
|
12
|
+
def call_with_model_creation
|
13
|
+
@app = lambda do |env|
|
14
|
+
Thread.current[:creations] = :creations
|
15
|
+
[200, env, ['hello']]
|
19
16
|
end
|
17
|
+
@middleware = CreationsMonitor.new(@app, @client)
|
18
|
+
end
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
def test_behaves_like_rack_middleware
|
21
|
+
call_with_model_creation
|
22
|
+
@client.stubs(:enqueue)
|
23
|
+
response = @middleware.call(@env)
|
24
|
+
assert_equal [200, @env, ['hello']], response
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
def test_clients_queue_receive_creations
|
28
|
+
call_with_model_creation
|
29
|
+
@client.expects(:enqueue).with(:creations)
|
29
30
|
|
30
|
-
|
31
|
-
end
|
31
|
+
@middleware.call(@env)
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
[200, env, ['hello']]
|
38
|
-
end
|
39
|
-
@middleware = CreationsMonitor.new(@app, @client)
|
34
|
+
def call_without_model_creation
|
35
|
+
@app = lambda do |env|
|
36
|
+
[200, env, ['hello']]
|
40
37
|
end
|
38
|
+
@middleware = CreationsMonitor.new(@app, @client)
|
39
|
+
end
|
41
40
|
|
42
|
-
|
43
|
-
|
41
|
+
def test_behaves_like_rack_middleware
|
42
|
+
call_without_model_creation
|
43
|
+
response = @middleware.call(@env)
|
44
44
|
|
45
|
-
|
46
|
-
end
|
45
|
+
assert_equal [200, @env, ['hello']], response
|
47
46
|
end
|
48
47
|
end
|
49
48
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'sidekiq/testing'
|
3
|
+
require 'chillout/middleware/sidekiq'
|
4
|
+
|
5
|
+
module Chillout
|
6
|
+
module Middleware
|
7
|
+
class SidekiqTest < ChilloutTestCase
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@client = mock("Client")
|
11
|
+
@integration = Integrations::Sidekiq.new
|
12
|
+
@integration.enable(@client, ::Sidekiq::Testing)
|
13
|
+
end
|
14
|
+
|
15
|
+
def teardown
|
16
|
+
@integration.disable
|
17
|
+
end
|
18
|
+
|
19
|
+
class FakeJob
|
20
|
+
MOCK_CREATIONS = Object.new.freeze
|
21
|
+
include Sidekiq::Worker
|
22
|
+
def perform
|
23
|
+
Chillout.creations = MOCK_CREATIONS
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_enqueues_and_clears_creations
|
28
|
+
@client.expects(:enqueue).with(FakeJob::MOCK_CREATIONS)
|
29
|
+
Sidekiq::Testing.inline! { FakeJob.perform_async }
|
30
|
+
assert_nil Chillout.creations
|
31
|
+
end
|
32
|
+
|
33
|
+
class EmptyJob
|
34
|
+
include Sidekiq::Worker
|
35
|
+
def perform; end
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_does_nothing_when_no_creations
|
39
|
+
Sidekiq::Testing.inline! { EmptyJob.perform_async }
|
40
|
+
assert_nil Chillout.creations
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -32,5 +32,18 @@ module Chillout
|
|
32
32
|
})
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
def test_customized_host_port_and_ssl
|
37
|
+
ENV['CHILLOUT_CLIENT_HOST'] = 'localhost'
|
38
|
+
ENV['CHILLOUT_CLIENT_PORT'] = '8080'
|
39
|
+
ENV['CHILLOUT_CLIENT_SSL'] = 'false'
|
40
|
+
client = PlainHttpClient.new
|
41
|
+
assert_equal 'localhost', client.host
|
42
|
+
assert_equal 8080, client.port
|
43
|
+
assert_equal false, client.ssl
|
44
|
+
ENV.delete('CHILLOUT_CLIENT_HOST')
|
45
|
+
ENV.delete('CHILLOUT_CLIENT_PORT')
|
46
|
+
ENV.delete('CHILLOUT_CLIENT_SSL')
|
47
|
+
end
|
35
48
|
end
|
36
49
|
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
Rails3213::Application.load_tasks
|
@@ -0,0 +1,70 @@
|
|
1
|
+
class EntitiesController < ApplicationController
|
2
|
+
def index
|
3
|
+
@entities = Entity.all
|
4
|
+
|
5
|
+
respond_to do |format|
|
6
|
+
format.html # index.html.erb
|
7
|
+
format.json { render :json => @entities }
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
@entity = Entity.find(params[:id])
|
13
|
+
|
14
|
+
respond_to do |format|
|
15
|
+
format.html # show.html.erb
|
16
|
+
format.json { render :json => @entity }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def new
|
21
|
+
@entity = Entity.new
|
22
|
+
|
23
|
+
respond_to do |format|
|
24
|
+
format.html # new.html.erb
|
25
|
+
format.json { render :json => @entity }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def edit
|
30
|
+
@entity = Entity.find(params[:id])
|
31
|
+
end
|
32
|
+
|
33
|
+
def create
|
34
|
+
@entity = Entity.new(params[:entity])
|
35
|
+
|
36
|
+
respond_to do |format|
|
37
|
+
if @entity.save
|
38
|
+
format.html { redirect_to @entity, :notice => 'Entity was successfully created.' }
|
39
|
+
format.json { render :json => @entity, :status => :created, :location => @entity }
|
40
|
+
else
|
41
|
+
format.html { render :action => "new" }
|
42
|
+
format.json { render :json => @entity.errors, :status => :unprocessable_entity }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def update
|
48
|
+
@entity = Entity.find(params[:id])
|
49
|
+
|
50
|
+
respond_to do |format|
|
51
|
+
if @entity.update_attributes(params[:entity])
|
52
|
+
format.html { redirect_to @entity, :notice => 'Entity was successfully updated.' }
|
53
|
+
format.json { head :no_content }
|
54
|
+
else
|
55
|
+
format.html { render :action => "edit" }
|
56
|
+
format.json { render :json => @entity.errors, :status => :unprocessable_entity }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def destroy
|
62
|
+
@entity = Entity.find(params[:id])
|
63
|
+
@entity.destroy
|
64
|
+
|
65
|
+
respond_to do |format|
|
66
|
+
format.html { redirect_to entities_url }
|
67
|
+
format.json { head :no_content }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= form_for(@entity) do |f| %>
|
2
|
+
<% if @entity.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@entity.errors.count, "error") %> prohibited this entity from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @entity.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :name %><br />
|
16
|
+
<%= f.text_field :name %>
|
17
|
+
</div>
|
18
|
+
<div class="actions">
|
19
|
+
<%= f.submit %>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<h1>Listing entities</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Name</th>
|
6
|
+
<th></th>
|
7
|
+
<th></th>
|
8
|
+
<th></th>
|
9
|
+
</tr>
|
10
|
+
|
11
|
+
<% @entities.each do |entity| %>
|
12
|
+
<tr>
|
13
|
+
<td><%= entity.name %></td>
|
14
|
+
<td><%= link_to 'Show', entity %></td>
|
15
|
+
<td><%= link_to 'Edit', edit_entity_path(entity) %></td>
|
16
|
+
<td><%= link_to 'Destroy', entity, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
17
|
+
</tr>
|
18
|
+
<% end %>
|
19
|
+
</table>
|
20
|
+
|
21
|
+
<br />
|
22
|
+
|
23
|
+
<%= link_to 'New Entity', new_entity_path %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>SampleRailsApp</title>
|
5
|
+
<%= stylesheet_link_tag "application", :media => "all" %>
|
6
|
+
<%= javascript_include_tag "application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|