grape-swagger-rails 0.3.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/danger.yml +19 -0
  3. data/.github/workflows/head.yml +32 -0
  4. data/.github/workflows/rubocop.yml +14 -0
  5. data/.github/workflows/test.yml +35 -0
  6. data/.rubocop.yml +7 -2
  7. data/.rubocop_todo.yml +103 -32
  8. data/CHANGELOG.md +25 -14
  9. data/Dangerfile +2 -0
  10. data/Gemfile +24 -16
  11. data/README.md +32 -2
  12. data/RELEASING.md +4 -5
  13. data/Rakefile +5 -9
  14. data/app/assets/config/grape_swagger_rails_manifest.js +2 -0
  15. data/app/controllers/grape_swagger_rails/application_controller.rb +4 -2
  16. data/app/views/grape_swagger_rails/application/index.html.erb +1 -1
  17. data/config/routes.rb +2 -0
  18. data/grape-swagger-rails.gemspec +13 -29
  19. data/lib/grape-swagger-rails/engine.rb +2 -0
  20. data/lib/grape-swagger-rails/version.rb +3 -1
  21. data/lib/grape-swagger-rails.rb +17 -14
  22. data/lib/script/rails +4 -2
  23. data/lib/tasks/swagger_ui.rake +6 -3
  24. data/spec/dummy/Rakefile +6 -3
  25. data/spec/dummy/app/api/api.rb +2 -0
  26. data/spec/dummy/app/assets/config/manifest.js +3 -0
  27. data/spec/dummy/app/assets/javascripts/application.js +0 -2
  28. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  29. data/spec/dummy/app/controllers/welcome_controller.rb +3 -2
  30. data/spec/dummy/app/views/layouts/application.html.erb +1 -0
  31. data/spec/dummy/bin/rails +3 -5
  32. data/spec/dummy/bin/rake +2 -4
  33. data/spec/dummy/bin/setup +27 -0
  34. data/spec/dummy/config/application.rb +11 -10
  35. data/spec/dummy/config/boot.rb +4 -7
  36. data/spec/dummy/config/environment.rb +6 -2
  37. data/spec/dummy/config/environments/development.rb +40 -19
  38. data/spec/dummy/config/environments/production.rb +31 -31
  39. data/spec/dummy/config/environments/test.rb +30 -20
  40. data/spec/dummy/config/initializers/assets.rb +13 -0
  41. data/spec/dummy/config/initializers/filter_parameter_logging.rb +10 -0
  42. data/spec/dummy/config/initializers/inflections.rb +18 -0
  43. data/spec/dummy/config/initializers/swagger.rb +2 -0
  44. data/spec/dummy/config/routes.rb +2 -0
  45. data/spec/dummy/config.ru +6 -2
  46. data/spec/dummy/public/404.html +6 -6
  47. data/spec/dummy/public/422.html +6 -6
  48. data/spec/dummy/public/500.html +6 -6
  49. data/spec/features/grape-swagger-rails_spec.rb +5 -1
  50. data/spec/features/swagger_spec.rb +97 -35
  51. data/spec/features/welcome_spec.rb +3 -0
  52. data/spec/spec_helper.rb +4 -2
  53. data/spec/support/capybara.rb +3 -0
  54. data/spec/support/rails.rb +2 -0
  55. metadata +25 -340
  56. data/.travis.yml +0 -53
  57. data/spec/dummy/bin/bundle +0 -3
  58. data/spec/dummy/bin/spring +0 -18
  59. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -1
  60. data/spec/dummy/config/initializers/session_store.rb +0 -1
  61. data/spec/dummy/vendor/assets/javascripts/.keep +0 -0
  62. data/spec/dummy/vendor/assets/stylesheets/.keep +0 -0
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GrapeSwaggerRails
2
4
  class Engine < ::Rails::Engine
3
5
  paths['lib/tasks'] = 'lib/tasks/exported'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GrapeSwaggerRails
2
- VERSION = '0.3.1'.freeze
4
+ VERSION = '0.5.0'
3
5
  end
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'grape-swagger-rails/engine'
4
+ require 'ostruct'
2
5
 
3
6
  module GrapeSwaggerRails
4
7
  class Options < OpenStruct
@@ -20,24 +23,24 @@ module GrapeSwaggerRails
20
23
  mattr_accessor :options
21
24
 
22
25
  self.options = Options.new(
26
+ url: '/swagger_doc',
27
+ app_name: 'Swagger',
28
+ app_url: 'http://swagger.wordnik.com',
23
29
 
24
- url: '/swagger_doc',
25
- app_name: 'Swagger',
26
- app_url: 'http://swagger.wordnik.com',
27
-
28
- headers: {},
30
+ headers: {},
29
31
 
30
- api_auth: '', # 'basic' or 'bearer'
31
- api_key_name: 'api_key', # 'Authorization'
32
- api_key_type: 'query', # 'header'
33
- api_key_default_value: '', # Auto populates api_key
32
+ api_auth: '', # 'basic' or 'bearer'
33
+ api_key_name: 'api_key', # 'Authorization'
34
+ api_key_type: 'query', # 'header'
35
+ api_key_default_value: '', # Auto populates api_key
36
+ api_key_placeholder: 'api_key', # Placeholder for api_key input
34
37
 
35
- doc_expansion: 'none',
36
- supported_submit_methods: %w(get post put delete patch),
38
+ doc_expansion: 'none',
39
+ supported_submit_methods: %w[get post put delete patch],
37
40
 
38
- before_action_proc: nil, # Proc used as a controller before action
41
+ before_action_proc: nil, # Proc used as a controller before action
39
42
 
40
- hide_url_input: false,
41
- hide_api_key_input: false
43
+ hide_url_input: false,
44
+ hide_api_key_input: false
42
45
  )
43
46
  end
data/lib/script/rails CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
5
 
4
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
- ENGINE_PATH = File.expand_path('../../lib/grape-swagger-rails/engine', __FILE__)
6
+ ENGINE_ROOT = File.expand_path('..', __dir__)
7
+ ENGINE_PATH = File.expand_path('../lib/grape-swagger-rails/engine', __dir__)
6
8
 
7
9
  require 'rails/all'
8
10
  require 'rails/engine/commands'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'git'
2
4
 
3
5
  namespace :swagger_ui do
@@ -9,7 +11,7 @@ namespace :swagger_ui do
9
11
  # clone wordnik/swagger-ui
10
12
  Git.clone 'git@github.com:wordnik/swagger-ui.git', 'swagger-ui', path: dir, depth: 0
11
13
  # prune local files
12
- root = File.expand_path '../../..', __FILE__
14
+ root = File.expand_path '../..', __dir__
13
15
  puts "Removing files from #{root} ..."
14
16
  repo = Git.open root
15
17
  # Javascripts
@@ -17,7 +19,8 @@ namespace :swagger_ui do
17
19
  FileUtils.rm_r "#{root}/app/assets/javascripts/grape_swagger_rails"
18
20
  FileUtils.cp_r "#{dir}/swagger-ui/dist/lib", "#{root}/app/assets/javascripts"
19
21
  FileUtils.mv "#{root}/app/assets/javascripts/lib", "#{root}/app/assets/javascripts/grape_swagger_rails"
20
- FileUtils.cp_r Dir.glob("#{dir}/swagger-ui/dist/swagger-ui.min.js"), "#{root}/app/assets/javascripts/grape_swagger_rails"
22
+ FileUtils.cp_r Dir.glob("#{dir}/swagger-ui/dist/swagger-ui.min.js"),
23
+ "#{root}/app/assets/javascripts/grape_swagger_rails"
21
24
  FileUtils.cp Dir.glob("#{root}/lib/javascripts/*.js"), "#{root}/app/assets/javascripts/grape_swagger_rails"
22
25
  # Generate application.js
23
26
  JAVASCRIPT_FILES = [
@@ -74,7 +77,7 @@ namespace :swagger_ui do
74
77
  # rewrite screen.css into screen.css.erb with dynamic image paths
75
78
  File.open "#{root}/app/assets/stylesheets/grape_swagger_rails/screen.css.erb", 'w+' do |file|
76
79
  contents = File.read "#{root}/app/assets/stylesheets/grape_swagger_rails/screen.css"
77
- contents.gsub! /url\((\'*).*\/(?<filename>[\w\.]*)(\'*)\)/ do |_match|
80
+ contents.gsub!(%r{url\(('*).*/(?<filename>[\w.]*)('*)\)}) do |_match|
78
81
  "url(<%= image_path('grape_swagger_rails/#{$LAST_MATCH_INFO[:filename]}') %>)"
79
82
  end
80
83
  file.write contents
data/spec/dummy/Rakefile CHANGED
@@ -1,5 +1,8 @@
1
- #!/usr/bin/env rake
1
+ # frozen_string_literal: true
2
2
 
3
- require File.expand_path('../config/application', __FILE__)
3
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
4
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
5
 
5
- Dummy::Application.load_tasks
6
+ require_relative 'config/application'
7
+
8
+ Rails.application.load_tasks
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class API < Grape::API
2
4
  prefix 'api'
3
5
 
@@ -0,0 +1,3 @@
1
+ //= link_directory ../stylesheets .css
2
+ //= link_directory ../javascripts .js
3
+ //= link grape_swagger_rails_manifest.js
@@ -1,3 +1 @@
1
- //= require jquery
2
- //= require jquery_ujs
3
1
  //= require_tree .
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ApplicationController < ActionController::Base
2
4
  protect_from_forgery with: :exception
3
5
  end
@@ -1,4 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class WelcomeController < ApplicationController
2
- def index
3
- end
4
+ def index; end
4
5
  end
@@ -5,6 +5,7 @@
5
5
  <%= stylesheet_link_tag 'application', media: 'all' %>
6
6
  <%= javascript_include_tag 'application' %>
7
7
  <%= csrf_meta_tags %>
8
+ <%= csp_meta_tag %>
8
9
  </head>
9
10
  <body>
10
11
 
data/spec/dummy/bin/rails CHANGED
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- begin
3
- load File.expand_path('../spring', __FILE__)
4
- rescue LoadError
5
- end
6
- APP_PATH = File.expand_path('../../config/application', __FILE__)
2
+ # frozen_string_literal: true
3
+
4
+ APP_PATH = File.expand_path('../config/application', __dir__)
7
5
  require_relative '../config/boot'
8
6
  require 'rails/commands'
data/spec/dummy/bin/rake CHANGED
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- begin
3
- load File.expand_path('../spring', __FILE__)
4
- rescue LoadError
5
- end
2
+ # frozen_string_literal: true
3
+
6
4
  require_relative '../config/boot'
7
5
  require 'rake'
8
6
  Rake.application.run
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'fileutils'
5
+
6
+ # path to your application root.
7
+ APP_ROOT = File.expand_path('..', __dir__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ FileUtils.chdir APP_ROOT do
14
+ # This script is a way to set up or update your development environment automatically.
15
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
16
+ # Add necessary setup steps to this file.
17
+
18
+ puts '== Installing dependencies =='
19
+ system! 'gem install bundler --conservative'
20
+ system('bundle check') || system!('bundle install')
21
+
22
+ puts "\n== Removing old logs and tempfiles =="
23
+ system! 'bin/rails log:clear tmp:clear'
24
+
25
+ puts "\n== Restarting application server =="
26
+ system! 'bin/rails restart'
27
+ end
@@ -1,23 +1,24 @@
1
- require File.expand_path('../boot', __FILE__)
1
+ # frozen_string_literal: true
2
2
 
3
- require 'action_controller/railtie'
4
- require 'action_view/railtie'
5
- require 'sprockets/railtie'
6
- require 'jquery-rails'
7
- require 'rack/cors'
8
- require 'rack/no_animations'
3
+ require_relative 'boot'
9
4
 
5
+ require 'rails/all'
6
+
7
+ # Require the gems listed in Gemfile, including any gems
8
+ # you've limited to :test, :development, or :production.
10
9
  Bundler.require(*Rails.groups)
11
10
  require 'grape-swagger-rails'
12
11
 
13
12
  module Dummy
14
13
  class Application < Rails::Application
15
- config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
16
- config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
14
+ config.load_defaults Rails::VERSION::STRING.to_f
15
+
16
+ # For compatibility with applications that use this config
17
+ config.action_controller.include_all_helpers = false
17
18
  config.middleware.use Rack::Cors do
18
19
  allow do
19
20
  origins '*'
20
- resource '*', headers: :any, methods: [:get, :post, :options]
21
+ resource '*', headers: :any, methods: %i[get post options]
21
22
  end
22
23
  end
23
24
  end
@@ -1,10 +1,7 @@
1
- require 'rubygems'
1
+ # frozen_string_literal: true
2
2
 
3
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
4
5
 
5
6
  require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
6
-
7
- require 'sass'
8
- require 'grape'
9
- require 'grape-swagger'
10
- require 'coffee_script'
7
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -1,3 +1,7 @@
1
- require File.expand_path('../application', __FILE__)
1
+ # frozen_string_literal: true
2
2
 
3
- Dummy::Application.initialize!
3
+ # Load the Rails application.
4
+ require_relative 'application'
5
+
6
+ # Initialize the Rails application.
7
+ Rails.application.initialize!
@@ -1,37 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/integer/time'
4
+
1
5
  Rails.application.configure do
2
6
  # Settings specified here will take precedence over those in config/application.rb.
3
7
 
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
8
+ # In the development environment your application's code is reloaded any time
9
+ # it changes. This slows down response time but is perfect for development
6
10
  # since you don't have to restart the web server when you make code changes.
7
11
  config.cache_classes = false
8
12
 
9
13
  # Do not eager load code on boot.
10
14
  config.eager_load = false
11
15
 
12
- # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
16
+ # Show full error reports.
17
+ config.consider_all_requests_local = true
18
+
19
+ # Enable server timing
20
+ config.server_timing = true
21
+
22
+ # Enable/disable caching. By default caching is disabled.
23
+ # Run rails dev:cache to toggle caching.
24
+ if Rails.root.join('tmp/caching-dev.txt').exist?
25
+ config.action_controller.perform_caching = true
26
+ config.action_controller.enable_fragment_cache_logging = true
15
27
 
16
- # Don't care if the mailer can't send.
17
- # config.action_mailer.raise_delivery_errors = false
28
+ config.cache_store = :memory_store
29
+ config.public_file_server.headers = {
30
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
31
+ }
32
+ else
33
+ config.action_controller.perform_caching = false
34
+
35
+ config.cache_store = :null_store
36
+ end
18
37
 
19
38
  # Print deprecation notices to the Rails logger.
20
39
  config.active_support.deprecation = :log
21
40
 
22
- # Debug mode disables concatenation and preprocessing of assets.
23
- # This option may cause significant delays in view rendering with a large
24
- # number of complex assets.
25
- config.assets.debug = true
41
+ # Raise exceptions for disallowed deprecations.
42
+ config.active_support.disallowed_deprecation = :raise
43
+
44
+ # Tell Active Support which deprecation messages to disallow.
45
+ config.active_support.disallowed_deprecation_warnings = []
46
+
47
+ # Suppress logger output for asset requests.
48
+ config.assets.quiet = true
26
49
 
27
- # Adds additional error checking when serving assets at runtime.
28
- # Checks for improperly declared sprockets dependencies.
29
- # Raises helpful error messages.
30
- config.assets.raise_runtime_errors = true
50
+ # Raises error for missing translations.
51
+ # config.i18n.raise_on_missing_translations = true
31
52
 
32
- # Raises error for missing translations
33
- # config.action_view.raise_on_missing_translations = true
53
+ # Annotate rendered view with file names.
54
+ # config.action_view.annotate_rendered_view_with_filenames = true
34
55
 
35
- # Disable animations
36
- config.middleware.use Rack::NoAnimations
56
+ # Uncomment if you wish to allow Action Cable access from any origin.
57
+ # config.action_cable.disable_request_forgery_protection = true
37
58
  end
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/integer/time'
4
+
1
5
  Rails.application.configure do
2
6
  # Settings specified here will take precedence over those in config/application.rb.
3
7
 
@@ -14,16 +18,17 @@ Rails.application.configure do
14
18
  config.consider_all_requests_local = false
15
19
  config.action_controller.perform_caching = true
16
20
 
17
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
- # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
- # config.action_dispatch.rack_cache = true
21
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
22
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
23
+ # config.require_master_key = true
21
24
 
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_files = false
25
+ # Disable serving static files from the `/public` folder by default since
26
+ # Apache or NGINX already handles this.
27
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
24
28
 
25
29
  # Compress JavaScripts and CSS.
26
30
  config.assets.js_compressor = :uglifier
31
+ # Compress CSS using a preprocessor.
27
32
  # config.assets.css_compressor = :sass
28
33
 
29
34
  # Do not fallback to assets pipeline if a precompiled asset is missed.
@@ -32,48 +37,43 @@ Rails.application.configure do
32
37
  # Generate digests for assets URLs.
33
38
  config.assets.digest = true
34
39
 
35
- # `config.assets.precompile` has moved to config/initializers/assets.rb
40
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
41
+ # config.asset_host = "http://assets.example.com"
36
42
 
37
43
  # Specifies the header that your server uses for sending files.
38
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
39
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
44
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
45
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
40
46
 
41
47
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
42
48
  # config.force_ssl = true
43
49
 
44
- # Set to :debug to see everything in the log.
50
+ # Include generic and useful information about system operation, but avoid logging too much
51
+ # information to avoid inadvertent exposure of personally identifiable information (PII).
45
52
  config.log_level = :info
46
53
 
47
54
  # Prepend all log lines with the following tags.
48
- # config.log_tags = [ :subdomain, :uuid ]
49
-
50
- # Use a different logger for distributed setups.
51
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
55
+ config.log_tags = [:request_id]
52
56
 
53
57
  # Use a different cache store in production.
54
58
  # config.cache_store = :mem_cache_store
55
59
 
56
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
57
- # config.action_controller.asset_host = "http://assets.example.com"
58
-
59
- # Precompile additional assets.
60
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
61
- # config.assets.precompile += %w( search.js )
62
-
63
- # Ignore bad email addresses and do not raise email delivery errors.
64
- # Set this to true and configure the email server for immediate delivery to raise delivery errors.
65
- # config.action_mailer.raise_delivery_errors = false
66
-
67
60
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
68
61
  # the I18n.default_locale when a translation cannot be found).
69
62
  config.i18n.fallbacks = true
70
63
 
71
- # Send deprecation notices to registered listeners.
72
- config.active_support.deprecation = :notify
73
-
74
- # Disable automatic flushing of the log to improve performance.
75
- # config.autoflush_log = false
64
+ # Don't log any deprecations.
65
+ config.active_support.report_deprecations = false
76
66
 
77
67
  # Use default logging formatter so that PID and timestamp are not suppressed.
78
- config.log_formatter = ::Logger::Formatter.new
68
+ config.log_formatter = Logger::Formatter.new
69
+
70
+ # Use a different logger for distributed setups.
71
+ # require "syslog/logger"
72
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
73
+
74
+ if ENV['RAILS_LOG_TO_STDOUT'].present?
75
+ logger = ActiveSupport::Logger.new($stdout)
76
+ logger.formatter = config.log_formatter
77
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
78
+ end
79
79
  end
@@ -1,24 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/integer/time'
4
+
5
+ # The test environment is used exclusively to run your application's
6
+ # test suite. You never need to work with it otherwise. Remember that
7
+ # your test database is "scratch space" for the test suite and is wiped
8
+ # and recreated between test runs. Don't rely on the data there!
9
+
1
10
  Rails.application.configure do
2
11
  # Settings specified here will take precedence over those in config/application.rb.
3
12
 
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
13
+ # Turn false under Spring and add config.action_view.cache_template_loading = true.
8
14
  config.cache_classes = true
9
15
 
10
- # Do not eager load code on boot. This avoids loading your whole application
11
- # just for the purpose of running a single test. If you are using a tool that
12
- # preloads Rails for running tests, you may have to set it to true.
13
- config.eager_load = false
16
+ # Eager loading loads your whole application. When running a single test locally,
17
+ # this probably isn't necessary. It's a good idea to do in a continuous integration
18
+ # system, or in some way before deploying your code.
19
+ config.eager_load = ENV['CI'].present?
14
20
 
15
- # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_files = true
17
- config.static_cache_control = 'public, max-age=3600'
21
+ # Configure public file server for tests with Cache-Control for performance.
22
+ config.public_file_server.enabled = true
23
+ config.public_file_server.headers = {
24
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
25
+ }
18
26
 
19
27
  # Show full error reports and disable caching.
20
28
  config.consider_all_requests_local = true
21
29
  config.action_controller.perform_caching = false
30
+ config.cache_store = :null_store
22
31
 
23
32
  # Raise exceptions instead of rendering exception templates.
24
33
  config.action_dispatch.show_exceptions = false
@@ -26,17 +35,18 @@ Rails.application.configure do
26
35
  # Disable request forgery protection in test environment.
27
36
  config.action_controller.allow_forgery_protection = false
28
37
 
29
- # Tell Action Mailer not to deliver emails to the real world.
30
- # The :test delivery method accumulates sent emails in the
31
- # ActionMailer::Base.deliveries array.
32
- # config.action_mailer.delivery_method = :test
33
-
34
38
  # Print deprecation notices to the stderr.
35
39
  config.active_support.deprecation = :stderr
36
40
 
37
- # Raises error for missing translations
38
- # config.action_view.raise_on_missing_translations = true
41
+ # Raise exceptions for disallowed deprecations.
42
+ config.active_support.disallowed_deprecation = :raise
43
+
44
+ # Tell Active Support which deprecation messages to disallow.
45
+ config.active_support.disallowed_deprecation_warnings = []
46
+
47
+ # Raises error for missing translations.
48
+ # config.i18n.raise_on_missing_translations = true
39
49
 
40
- # Disable animations
41
- config.middleware.use Rack::NoAnimations
50
+ # Annotate rendered view with file names.
51
+ # config.action_view.annotate_rendered_view_with_filenames = true
42
52
  end
@@ -1 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Version of your assets, change this if you want to expire all your assets.
1
6
  Rails.application.config.assets.version = '1.0'
7
+
8
+ # Add additional assets to the asset load path.
9
+ # Rails.application.config.assets.paths << Emoji.images_path
10
+
11
+ # Precompile additional assets.
12
+ # application.js, application.css, and all non-JS/CSS in the app/assets
13
+ # folder are already added.
14
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Configure parameters to be filtered from the log file. Use this to limit dissemination of
6
+ # sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
7
+ # notations and behaviors.
8
+ Rails.application.config.filter_parameters += %i[
9
+ passw secret token _key crypt salt certificate otp ssn
10
+ ]
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Add new inflection rules using the following format. Inflections
6
+ # are locale specific, and you may define rules for as many different
7
+ # locales as you wish. All of these examples are active by default:
8
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
9
+ # inflect.plural /^(ox)$/i, "\\1en"
10
+ # inflect.singular /^(ox)en/i, "\\1"
11
+ # inflect.irregular "person", "people"
12
+ # inflect.uncountable %w( fish sheep )
13
+ # end
14
+
15
+ # These inflection rules are supported but not enabled by default:
16
+ ActiveSupport::Inflector.inflections(:en) do |inflect|
17
+ inflect.acronym 'API'
18
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  GrapeSwaggerRails.options.url = '/api/swagger_doc'
2
4
  GrapeSwaggerRails.options.app_name = 'Swagger'
3
5
  GrapeSwaggerRails.options.app_url = 'http://localhost:3000'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Rails.application.routes.draw do
2
4
  root 'welcome#index'
3
5
  mount API => '/'
data/spec/dummy/config.ru CHANGED
@@ -1,4 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is used by Rack-based servers to start the application.
2
4
 
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Dummy::Application
5
+ require_relative 'config/environment'
6
+
7
+ run Rails.application
8
+ Rails.application.load_server