padrino-core 0.15.3 → 0.16.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/bin/padrino +1 -1
  3. data/lib/padrino-core/application/application_setup.rb +2 -2
  4. data/lib/padrino-core/application/routing.rb +5 -6
  5. data/lib/padrino-core/application.rb +1 -1
  6. data/lib/padrino-core/caller.rb +3 -4
  7. data/lib/padrino-core/cli/base.rb +7 -7
  8. data/lib/padrino-core/cli/binstub.rb +1 -1
  9. data/lib/padrino-core/cli/launcher.rb +6 -6
  10. data/lib/padrino-core/cli/rake.rb +7 -3
  11. data/lib/padrino-core/cli/rake_tasks.rb +4 -4
  12. data/lib/padrino-core/command.rb +1 -1
  13. data/lib/padrino-core/loader.rb +7 -8
  14. data/lib/padrino-core/path_router/route.rb +1 -1
  15. data/lib/padrino-core/reloader.rb +1 -1
  16. data/lib/padrino-core/router.rb +4 -4
  17. data/lib/padrino-core/server.rb +8 -16
  18. data/lib/padrino-core/version.rb +1 -1
  19. data/padrino-core.gemspec +3 -4
  20. data/test/fixtures/app_gem/app_gem.gemspec +3 -4
  21. data/test/fixtures/apps/mountable_apps/rack_apps.rb +1 -1
  22. data/test/fixtures/apps/stealthy/helpers/stealthy_class_helpers.rb +1 -2
  23. data/test/fixtures/dependencies/circular/e.rb +0 -2
  24. data/test/helper.rb +1 -1
  25. data/test/test_application.rb +3 -3
  26. data/test/test_configuration.rb +9 -9
  27. data/test/test_core.rb +5 -5
  28. data/test/test_csrf_protection.rb +10 -2
  29. data/test/test_dependencies.rb +3 -3
  30. data/test/test_flash.rb +1 -1
  31. data/test/test_locale.rb +1 -1
  32. data/test/test_logger.rb +24 -25
  33. data/test/test_mounter.rb +3 -3
  34. data/test/test_params_protection.rb +5 -5
  35. data/test/test_reloader_simple.rb +2 -2
  36. data/test/test_reloader_storage.rb +1 -1
  37. data/test/test_routing.rb +13 -14
  38. metadata +25 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7b0401b770a137f350c55ea76cc2edc52718927473c036e3fad135c2b8022ce
4
- data.tar.gz: 0154f48a45c976b9bc672fc919d276b8e5826ab751e7640326ce9a5249a5aaa5
3
+ metadata.gz: ef80f6ccc004fbebb794783763e02edbeb25131683c36fd064082a64e1beb91b
4
+ data.tar.gz: d25da6fdd5f71f04df8d3eeed2cfa09a3f35e7dcfb77c101852474a8a1c53db5
5
5
  SHA512:
6
- metadata.gz: 10c221aa6fec0c7d6d3cf2aa0827c6d4701af14caf03cc24b40ec886ae38461d1b8a71b4ffafdda0975b3b8cf78f16e37d789a9d684aa17067f7f9720d09a737
7
- data.tar.gz: 482ad64bee105627b9cb4600e1296cfc050a3fbb5813aa919c11ca26a4f09a36961ba288a0059f653edcd99a57ec2370a233bc78eef4b10a5f1e5572e572ffa3
6
+ metadata.gz: 38a11cef63592b9c71ccef65de8d0550aed062b01419b32b7836e5d442d8416bdeb0fe16fae744262150ae817e1cfc295fe5ef9157d561c6f0312d7d5d52d393
7
+ data.tar.gz: be7c8f507fa3d480a6f0b78c89aabdc507be9800ce220992de5e7da8ecb1c3b9ba15aa8499503d15b314ceb61b451ece64d06aeeec84e92f97dd993c661b0257
data/bin/padrino CHANGED
@@ -2,7 +2,7 @@
2
2
  require 'padrino-core/cli/binstub'
3
3
  Padrino.replace_with_binstub('padrino')
4
4
 
5
- padrino_core_path = File.expand_path('../../lib', __FILE__)
5
+ padrino_core_path = File.expand_path('../lib', __dir__)
6
6
  $:.unshift(padrino_core_path) if File.directory?(padrino_core_path) && !$:.include?(padrino_core_path)
7
7
 
8
8
  require 'padrino-core/cli/base'
@@ -95,7 +95,7 @@ module Padrino
95
95
  '/models.rb',
96
96
  '/models/**/*.rb',
97
97
  '/lib.rb',
98
- '/lib/**/*.rb',
98
+ '/lib/**/*.rb'
99
99
  ].map{ |glob| File.join(settings.root, glob) }
100
100
  end
101
101
 
@@ -134,7 +134,7 @@ module Padrino
134
134
  configure :production do
135
135
  error ::Exception do
136
136
  logger.exception env['sinatra.error']
137
- halt(500, { 'Content-Type' => 'text/html' }, ['<h1>Internal Server Error</h1>'])
137
+ halt(500, { 'content-type' => 'text/html' }, ['<h1>Internal Server Error</h1>'])
138
138
  end unless errors.has_key?(::Exception)
139
139
  end
140
140
  end
@@ -440,10 +440,9 @@ module Padrino
440
440
  when Array
441
441
  object.map { |item| value_to_param(item) }.compact
442
442
  when Hash
443
- object.inject({}) do |all, (key, value)|
443
+ object.each_with_object({}) do |(key, value), all|
444
444
  next all if value.nil?
445
445
  all[key] = value_to_param(value)
446
- all
447
446
  end
448
447
  when nil
449
448
  else
@@ -453,7 +452,7 @@ module Padrino
453
452
 
454
453
  # Add prefix slash if its not present and remove trailing slashes.
455
454
  def conform_uri(uri_string)
456
- uri_string.gsub(/^(?!\/)(.*)/, '/\1').gsub(/[\/]+$/, '')
455
+ uri_string.gsub(/^(?!\/)(.*)/, '/\1').gsub(/\/+$/, '')
457
456
  end
458
457
 
459
458
  ##
@@ -863,7 +862,7 @@ module Padrino
863
862
  path = File.expand_path(public_dir + unescape(path_info))
864
863
  return unless path.start_with?(public_dir)
865
864
  return unless File.file?(path)
866
- return path
865
+ path
867
866
  end
868
867
 
869
868
  #
@@ -993,7 +992,7 @@ module Padrino
993
992
  filter! :before if first_time
994
993
 
995
994
  catch(:pass) do
996
- begin
995
+
997
996
  (route.before_filters - settings.filters[:before]).each{|block| instance_eval(&block) }
998
997
  @layout = route.use_layout if route.use_layout
999
998
  route.custom_conditions.each {|block| pass if block.bind(self).call == false }
@@ -1002,7 +1001,7 @@ module Padrino
1002
1001
  halt(route_response)
1003
1002
  ensure
1004
1003
  (route.after_filters - settings.filters[:after]).each {|block| instance_eval(&block) }
1005
- end
1004
+
1006
1005
  end
1007
1006
  end
1008
1007
 
@@ -138,7 +138,7 @@ module Padrino
138
138
  'controllers/**/*.rb',
139
139
  'controllers.rb',
140
140
  'helpers/**/*.rb',
141
- 'helpers.rb',
141
+ 'helpers.rb'
142
142
  ].flat_map{ |file| Dir.glob(File.join(settings.root, file)) }
143
143
  end
144
144
 
@@ -19,7 +19,7 @@ module Padrino
19
19
  %r{custom_require\.rb$},
20
20
  %r{active_support},
21
21
  %r{/thor},
22
- %r{/lib/bundler},
22
+ %r{/lib/bundler}
23
23
  ] unless defined?(PADRINO_IGNORE_CALLERS)
24
24
 
25
25
  ##
@@ -27,7 +27,6 @@ module Padrino
27
27
  #
28
28
  PADRINO_IGNORE_CALLERS.concat(RUBY_IGNORE_CALLERS) if defined?(RUBY_IGNORE_CALLERS)
29
29
 
30
- private
31
30
  ##
32
31
  # The filename for the file that is the direct caller (first caller).
33
32
  #
@@ -48,7 +47,7 @@ module Padrino
48
47
  def self.caller_files
49
48
  caller(1).
50
49
  map { |line| line.split(/:(?=\d|in )/)[0,2] }.
51
- reject { |file,line| PADRINO_IGNORE_CALLERS.any? { |pattern| file =~ pattern } }.
52
- map { |file,line| file }
50
+ reject { |file,_line| PADRINO_IGNORE_CALLERS.any? { |pattern| file =~ pattern } }.
51
+ map { |file,_line| file }
53
52
  end
54
53
  end
@@ -16,7 +16,7 @@ module Padrino
16
16
  ARGV.clear
17
17
  ARGV.concat(args)
18
18
  puts "=> Executing Rake #{ARGV.join(' ')} ..."
19
- load File.expand_path('../rake.rb', __FILE__)
19
+ load File.expand_path('rake.rb', __dir__)
20
20
  Rake.application.init
21
21
  Rake.application.instance_variable_set(:@rakefile, __FILE__)
22
22
  load File.expand_path('Rakefile')
@@ -27,10 +27,10 @@ module Padrino
27
27
  map "c" => :console
28
28
  def console(*args)
29
29
  prepare :console
30
- require File.expand_path("../../version", __FILE__)
30
+ require File.expand_path('../version', __dir__)
31
31
  require File.expand_path('config/boot.rb')
32
32
  puts "=> Loading #{Padrino.env} console (Padrino v.#{Padrino.version})"
33
- require File.expand_path('../console', __FILE__)
33
+ require File.expand_path('console', __dir__)
34
34
  ARGV.clear
35
35
  if defined? Pry
36
36
  Pry.start
@@ -47,18 +47,18 @@ module Padrino
47
47
  desc "generate", "Executes the Padrino generator with given options (alternatively use 'gen' or 'g')."
48
48
  map ["gen", "g"] => :generate
49
49
  def generate(*args)
50
- begin
50
+
51
51
  # We try to load the vendored padrino-gen if exist
52
- padrino_gen_path = File.expand_path('../../../../../padrino-gen/lib', __FILE__)
52
+ padrino_gen_path = File.expand_path('../../../../padrino-gen/lib', __dir__)
53
53
  $:.unshift(padrino_gen_path) if File.directory?(padrino_gen_path) && !$:.include?(padrino_gen_path)
54
54
  require 'padrino-core/command'
55
55
  require 'padrino-gen/command'
56
56
  ARGV.shift
57
57
  ARGV << 'help' if ARGV.empty?
58
58
  Padrino.bin_gen(*ARGV)
59
- rescue
59
+ rescue StandardError
60
60
  puts "<= You need padrino-gen! Run: gem install padrino-gen"
61
- end
61
+
62
62
  end
63
63
 
64
64
  desc "version", "Show current Padrino version."
@@ -14,7 +14,7 @@ module Padrino
14
14
  project_root = project_root.rpartition('/').first
15
15
  end
16
16
 
17
- if %w(Gemfile .components).all? { |file| File.file?(File.join(project_root, file)) }
17
+ if %w[Gemfile .components].all? { |file| File.file?(File.join(project_root, file)) }
18
18
  binstub = File.join(project_root, 'bin', executable)
19
19
  if File.file?(binstub)
20
20
  exec Gem.ruby, binstub, *ARGV
@@ -21,7 +21,7 @@ module Padrino
21
21
  method_option :server_options, :type => :boolean, :desc => "Tells the current server handler's options that can be used with --options"
22
22
  def start(*args)
23
23
  prepare :start
24
- require File.expand_path("../adapter", __FILE__)
24
+ require File.expand_path('adapter', __dir__)
25
25
  require File.expand_path('config/boot.rb')
26
26
 
27
27
  if options[:server_options]
@@ -36,7 +36,7 @@ module Padrino
36
36
  method_option :pid, :type => :string, :aliases => "-p", :desc => "File to store pid", :default => 'tmp/pids/server.pid'
37
37
  def stop
38
38
  prepare :stop
39
- require File.expand_path("../adapter", __FILE__)
39
+ require File.expand_path('adapter', __dir__)
40
40
  Padrino::Cli::Adapter.stop(options)
41
41
  end
42
42
 
@@ -44,7 +44,7 @@ module Padrino
44
44
 
45
45
  # https://github.com/rack/rack/blob/master/lib/rack/server.rb\#L100
46
46
  def server_options(options)
47
- begin
47
+
48
48
  info = []
49
49
  server = Rack::Handler.get(options[:server]) || Rack::Handler.default(options)
50
50
  if server && server.respond_to?(:valid_options)
@@ -57,12 +57,12 @@ module Padrino
57
57
  info << " -O %-21s %s" % [name, description]
58
58
  has_options = true
59
59
  end
60
- return "" if !has_options
60
+ return "" unless has_options
61
61
  end
62
62
  info.join("\n")
63
63
  rescue NameError
64
- return "Warning: Could not find handler specified (#{options[:server] || 'default'}) to determine handler-specific options"
65
- end
64
+ "Warning: Could not find handler specified (#{options[:server] || 'default'}) to determine handler-specific options"
65
+
66
66
  end
67
67
 
68
68
  protected
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../tasks', __FILE__)
1
+ require File.expand_path('../tasks', __dir__)
2
2
  require 'rake'
3
3
  require 'rake/dsl_definition'
4
4
  require 'thor'
@@ -10,8 +10,12 @@ end
10
10
 
11
11
  module PadrinoTasks
12
12
  def self.init(init=false)
13
- Padrino::Tasks.files.flatten.uniq.each { |rakefile| Rake.application.add_import(rakefile) rescue puts "<= Failed load #{ext}" }
14
- load(File.expand_path('../rake_tasks.rb', __FILE__))
13
+ Padrino::Tasks.files.flatten.uniq.each { |rakefile| begin
14
+ Rake.application.add_import(rakefile)
15
+ rescue StandardError
16
+ puts "<= Failed load #{ext}"
17
+ end }
18
+ load(File.expand_path('rake_tasks.rb', __dir__))
15
19
  Rake.application.load_imports
16
20
  end
17
21
 
@@ -49,7 +49,7 @@ rescue ArgumentError
49
49
  end
50
50
 
51
51
  desc "Displays a listing of the named routes within a project, optionally only those matched by [query]"
52
- task :routes, [:query] => :environment do |t, args|
52
+ task :routes, [:query] => :environment do |_t, args|
53
53
  Padrino.mounted_apps.each do |app|
54
54
  list_app_routes(app, args)
55
55
  end
@@ -57,16 +57,16 @@ end
57
57
 
58
58
  desc "Displays a listing of the named routes a given app [app]"
59
59
  namespace :routes do
60
- task :app, [:app] => :environment do |t, args|
60
+ task :app, [:app] => :environment do |_t, args|
61
61
  app = Padrino.mounted_apps.find { |app| app.app_class == args.app }
62
62
  list_app_routes(app, args) if app
63
63
  end
64
64
  end
65
65
 
66
66
  Dir["{lib/tasks/**,tasks/**,test,spec}/*.rake"].each do |file|
67
- begin
67
+
68
68
  load(File.expand_path(file))
69
69
  rescue LoadError => e
70
70
  warn "#{file}: #{e.message}"
71
- end
71
+
72
72
  end
@@ -14,7 +14,7 @@ module Padrino
14
14
  # Padrino.bin('start', '-e production')
15
15
  #
16
16
  def self.bin(*args)
17
- @_padrino_bin ||= [self.ruby_command, File.expand_path("../../../bin/padrino", __FILE__)]
17
+ @_padrino_bin ||= [self.ruby_command, File.expand_path('../../bin/padrino', __dir__)]
18
18
  args.empty? ? @_padrino_bin : system(args.unshift(@_padrino_bin).join(" "))
19
19
  end
20
20
 
@@ -150,7 +150,7 @@ module Padrino
150
150
  error = fatal = loaded = nil
151
151
 
152
152
  files.dup.each do |file|
153
- begin
153
+
154
154
  Reloader.safe_load(file, options)
155
155
  files.delete(file)
156
156
  loaded = true
@@ -159,14 +159,13 @@ module Padrino
159
159
  logger.devel "Cyclic dependency reload for #{error.class}: #{error.message}"
160
160
  rescue Exception => fatal
161
161
  break
162
- end
162
+
163
163
  end
164
164
 
165
- if fatal || !loaded
166
- exception = fatal || error
167
- logger.exception exception, :short
168
- raise exception
169
- end
165
+ next unless fatal || !loaded
166
+ exception = fatal || error
167
+ logger.exception exception, :short
168
+ raise exception
170
169
  end
171
170
  end
172
171
 
@@ -196,7 +195,7 @@ module Padrino
196
195
  "#{root}/lib/**/*.rb",
197
196
  "#{root}/models/**/*.rb",
198
197
  "#{root}/shared/**/*.rb",
199
- "#{root}/config/apps.rb",
198
+ "#{root}/config/apps.rb"
200
199
  ]
201
200
  end
202
201
  end
@@ -55,7 +55,7 @@ module Padrino
55
55
  @path
56
56
  end
57
57
 
58
- SIGNIFICANT_VARIABLES_REGEX = /(^|[^\\])[:\*]([a-zA-Z0-9_]+)/.freeze
58
+ SIGNIFICANT_VARIABLES_REGEX = /(^|[^\\])[:*]([a-zA-Z0-9_]+)/.freeze
59
59
 
60
60
  ##
61
61
  # Returns signficant variable names.
@@ -24,7 +24,7 @@ module Padrino
24
24
  # Default excluded directories at Padrino.root are: test, spec, features, tmp, config, db and public
25
25
  #
26
26
  def exclude
27
- @_exclude ||= Set.new %w(test spec tmp features config public db).map{ |path| Padrino.root(path) }
27
+ @_exclude ||= Set.new(%w[test spec tmp features config public db].map{ |path| Padrino.root(path) })
28
28
  end
29
29
 
30
30
  ##
@@ -58,8 +58,8 @@ module Padrino
58
58
  raise ArgumentError, "app is required" if app.nil?
59
59
 
60
60
  path = path.chomp('/')
61
- match = Regexp.new("^#{Regexp.quote(path).gsub('/', '/+')}(.*)", nil, 'n')
62
- host = Regexp.new("^#{Regexp.quote(host)}$", true, 'n') unless host.nil? || host.is_a?(Regexp)
61
+ match = Regexp.new("^#{Regexp.quote(path).gsub('/', '/+')}(.*)", Regexp::NOENCODING)
62
+ host = Regexp.new("^#{Regexp.quote(host)}$", Regexp::NOENCODING) unless host.nil? || host.is_a?(Regexp)
63
63
 
64
64
  @mapping << [host, path, match, app]
65
65
  end
@@ -74,7 +74,7 @@ module Padrino
74
74
 
75
75
  @mapping.each do |host, path, match, app|
76
76
  next unless host.nil? || http_host =~ host
77
- next unless path_info =~ match && rest = $1
77
+ next unless path_info =~ match && rest = ::Regexp.last_match(1)
78
78
  next unless rest.empty? || rest[0] == ?/
79
79
 
80
80
  rest = "/" if rest.empty?
@@ -91,7 +91,7 @@ module Padrino
91
91
  env['SCRIPT_NAME'] = script_name
92
92
  env['PATH_INFO'] = path_info
93
93
  Padrino::Logger::Rack.new(nil,'/').send(:log, env, 404, {}, began_at) if logger.debug?
94
- [404, {"Content-Type" => "text/plain", "X-Cascade" => "pass"}, ["Not Found: #{path_info}"]]
94
+ [404, {"content-type" => "text/plain", "x-cascade" => "pass"}, ["Not Found: #{path_info}"]]
95
95
  end
96
96
  end
97
97
  end
@@ -12,7 +12,6 @@ module Padrino
12
12
  Server.start(*detect_application(options))
13
13
  end
14
14
 
15
- private
16
15
 
17
16
  #
18
17
  #
@@ -22,7 +21,7 @@ module Padrino
22
21
  config_file ||= default_config_file
23
22
  fail "Rack config file `#{config_file}` must have `.ru` extension" unless config_file =~ /\.ru$/
24
23
  rack_app, rack_options = Rack::Builder.parse_file(config_file)
25
- [rack_app, rack_options.merge(options)]
24
+ [rack_app, (rack_options || {}).merge(options)]
26
25
  else
27
26
  [Padrino.application, options]
28
27
  end
@@ -31,7 +30,7 @@ module Padrino
31
30
  ##
32
31
  # This module builds a Padrino server to run the project based on available handlers.
33
32
  #
34
- class Server < Rack::Server
33
+ class Server < Rackup::Server
35
34
  DEFAULT_ADDRESS = { :Host => '127.0.0.1', :Port => 3000 }
36
35
 
37
36
  # Server Handlers
@@ -65,16 +64,11 @@ module Padrino
65
64
  end
66
65
 
67
66
  # The application the server will run.
68
- def app
69
- @app
70
- end
67
+ attr_reader :app
71
68
  alias :wrapped_app :app
72
69
 
73
- def options
74
- @options
75
- end
70
+ attr_reader :options
76
71
 
77
- private
78
72
 
79
73
  # Detects the supported handler to use.
80
74
  #
@@ -83,11 +77,9 @@ module Padrino
83
77
  #
84
78
  def self.detect_rack_handler
85
79
  Handlers.each do |handler|
86
- begin
87
- return handler if Rack::Handler.get(handler.to_s.downcase)
88
- rescue LoadError
89
- rescue NameError
90
- end
80
+ return handler if Rackup::Handler.get(handler.to_s.downcase)
81
+ rescue LoadError, NameError
82
+ # Ignored
91
83
  end
92
84
  fail "Server handler (#{Handlers.join(', ')}) not found."
93
85
  end
@@ -110,7 +102,7 @@ module Padrino
110
102
  # Detects Host and Port for Rack server.
111
103
  #
112
104
  def self.detect_address(options)
113
- address = DEFAULT_ADDRESS.merge options.select{ |key| [:Host, :Port].include?(key) }
105
+ address = DEFAULT_ADDRESS.merge(options.select{ |key| [:Host, :Port].include?(key) })
114
106
  address[:Host] = options[:host] if options[:host]
115
107
  address[:Port] = options[:port] if options[:port]
116
108
  address
@@ -6,7 +6,7 @@
6
6
  #
7
7
  module Padrino
8
8
  # The version constant for the current version of Padrino.
9
- VERSION = '0.15.3' unless defined?(Padrino::VERSION)
9
+ VERSION = '0.16.0.pre3' unless defined?(Padrino::VERSION)
10
10
 
11
11
  #
12
12
  # The current Padrino version.
data/padrino-core.gemspec CHANGED
@@ -1,7 +1,5 @@
1
1
  #!/usr/bin/env gem build
2
- # encoding: utf-8
3
-
4
- require File.expand_path("../lib/padrino-core/version.rb", __FILE__)
2
+ require File.expand_path('lib/padrino-core/version.rb', __dir__)
5
3
 
6
4
  Gem::Specification.new do |s|
7
5
  s.name = "padrino-core"
@@ -23,6 +21,7 @@ Gem::Specification.new do |s|
23
21
  s.rdoc_options = ["--charset=UTF-8"]
24
22
 
25
23
  s.add_dependency("padrino-support", Padrino.version)
26
- s.add_dependency("sinatra", ">= 2.2.4")
24
+ s.add_dependency("rackup", "~> 2.1")
25
+ s.add_dependency("sinatra", "~> 4")
27
26
  s.add_dependency("thor", "~> 1.0")
28
27
  end
@@ -1,11 +1,10 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/app_gem/version', __FILE__)
1
+ require File.expand_path('lib/app_gem/version', __dir__)
3
2
 
4
3
  Gem::Specification.new do |gem|
5
4
  gem.authors = ["Florian Gilcher"]
6
5
  gem.email = ["florian.gilcher@asquera.de"]
7
- gem.description = %q{TODO: Write a gem description}
8
- gem.summary = %q{TODO: Write a gem summary}
6
+ gem.description = 'TODO: Write a gem description'
7
+ gem.summary = 'TODO: Write a gem summary'
9
8
  gem.homepage = ""
10
9
 
11
10
  gem.files = `git ls-files`.split($\)
@@ -13,7 +13,7 @@ class RackApp
13
13
  end
14
14
  end
15
15
 
16
- RackApp2 = lambda{|_| [200, {}, ["hello rack app2"]] }
16
+ RackApp2 = ->(_){ [200, {}, ["hello rack app2"]] }
17
17
 
18
18
  class SinatraApp < Sinatra::Base
19
19
  set :public_folder, File.dirname(__FILE__)
@@ -5,8 +5,7 @@ class Boo
5
5
  end
6
6
 
7
7
  class Woo < Boo
8
- def poo
9
- end
8
+ def poo; end
10
9
  end
11
10
 
12
11
  class Soo < Boo
@@ -7,7 +7,5 @@ class E
7
7
  subclass.fields.replace fields.dup
8
8
  end
9
9
 
10
- G
11
-
12
10
  fields << "name"
13
11
  end
data/test/helper.rb CHANGED
@@ -13,7 +13,7 @@ require 'padrino-core'
13
13
  require 'ext/minitest-spec'
14
14
  require 'ext/rack-test-methods'
15
15
 
16
- class MiniTest::Spec
16
+ class Minitest::Spec
17
17
  include Rack::Test::Methods
18
18
 
19
19
  # Sets up a Sinatra::Base subclass defined with the block
@@ -128,7 +128,7 @@ describe "Application" do
128
128
  it 'should have not mapped errors on development' do
129
129
  mock_app { get('/'){ 'HI' } }
130
130
  get "/"
131
- assert @app.errors.empty?
131
+ assert_empty @app.errors
132
132
  end
133
133
 
134
134
  it 'should have mapped errors on production' do
@@ -150,7 +150,7 @@ describe "Application" do
150
150
 
151
151
  it 'should pass Routing#parent to Module#parent' do
152
152
  # see naming collision in issue #1814
153
- begin
153
+
154
154
  ConstTest = Class.new(Padrino::Application)
155
155
  class Module
156
156
  def parent
@@ -160,7 +160,7 @@ describe "Application" do
160
160
  assert_equal :dirty, ConstTest.parent
161
161
  ensure
162
162
  Module.instance_eval{ undef :parent }
163
- end
163
+
164
164
  end
165
165
  end
166
166
 
@@ -2,28 +2,28 @@ require File.expand_path(File.dirname(__FILE__) + '/helper')
2
2
 
3
3
  describe "PadrinoConfiguration" do
4
4
  it 'should be able to store values' do
5
- Padrino.config.val1 = 12345
6
- assert_equal 12345, Padrino.config.val1
5
+ Padrino.config.val1 = 12_345
6
+ assert_equal 12_345, Padrino.config.val1
7
7
  end
8
8
 
9
9
  it 'should be able to configure with block' do
10
10
  Padrino.configure do |config|
11
- config.val2 = 54321
11
+ config.val2 = 54_321
12
12
  end
13
- assert_equal 54321, Padrino.config.val2
13
+ assert_equal 54_321, Padrino.config.val2
14
14
  end
15
15
 
16
16
  it 'should be able to configure with block' do
17
17
  Padrino.configure :test do |config|
18
- config.test1 = 54321
18
+ config.test1 = 54_321
19
19
  end
20
20
  Padrino.configure :development do |config|
21
- config.test1 = 12345
21
+ config.test1 = 12_345
22
22
  end
23
23
  Padrino.configure :test, :development do |config|
24
- config.both1 = 54321
24
+ config.both1 = 54_321
25
25
  end
26
- assert_equal 54321, Padrino.config.test1
27
- assert_equal 54321, Padrino.config.both1
26
+ assert_equal 54_321, Padrino.config.test1
27
+ assert_equal 54_321, Padrino.config.both1
28
28
  end
29
29
  end
data/test/test_core.rb CHANGED
@@ -19,13 +19,13 @@ describe "Core" do
19
19
 
20
20
  it 'should validate global helpers' do
21
21
  assert_equal :test, Padrino.env
22
- assert_match /\/test/, Padrino.root
22
+ assert_match(/\/test/, Padrino.root)
23
23
  assert Padrino.version
24
24
  end
25
25
 
26
26
  it 'should raise application error if I instantiate a new padrino application without mounted apps' do
27
27
  text = capture_io { Padrino.application }
28
- assert_match /No apps are mounted/, text.to_s
28
+ assert_match(/No apps are mounted/, text.to_s)
29
29
  end
30
30
 
31
31
  it 'should check before/after padrino load hooks' do
@@ -46,7 +46,7 @@ describe "Core" do
46
46
  def call(env)
47
47
  status, headers, body = @app.call(env)
48
48
  headers["Middleware-Called"] = "yes"
49
- return status, headers, body
49
+ [status, headers, body]
50
50
  end
51
51
  }
52
52
 
@@ -80,8 +80,8 @@ describe "Core" do
80
80
 
81
81
  get "/"
82
82
  assert_equal 500, status
83
- assert body.include?("StandardError")
84
- assert body.include?("<code>show_exceptions</code> setting")
83
+ assert_includes body, "StandardError"
84
+ assert_includes body, "<code>show_exceptions</code> setting"
85
85
  end
86
86
  end
87
87
  end
@@ -6,7 +6,11 @@ describe "Application" do
6
6
  describe 'CSRF protection' do
7
7
  describe "with CSRF protection on" do
8
8
  before do
9
- @token = Rack::Protection::AuthenticityToken.random_token rescue "a_token"
9
+ @token = begin
10
+ Rack::Protection::AuthenticityToken.random_token
11
+ rescue StandardError
12
+ "a_token"
13
+ end
10
14
  mock_app do
11
15
  enable :sessions
12
16
  enable :protect_from_csrf
@@ -142,7 +146,11 @@ describe "Application" do
142
146
 
143
147
  describe "with custom protection options" do
144
148
  before do
145
- @token = Rack::Protection::AuthenticityToken.random_token rescue "a_token"
149
+ @token = begin
150
+ Rack::Protection::AuthenticityToken.random_token
151
+ rescue StandardError
152
+ "a_token"
153
+ end
146
154
  mock_app do
147
155
  enable :sessions
148
156
  set :protect_from_csrf, :authenticity_param => 'foobar', :message => 'sucker!'
@@ -26,7 +26,7 @@ describe "Dependencies" do
26
26
  end
27
27
  end
28
28
  assert_equal 1, D
29
- assert_match /RuntimeError - SomeThing/, @io.string
29
+ assert_match(/RuntimeError - SomeThing/, @io.string)
30
30
  end
31
31
 
32
32
  it 'should resolve dependency problems' do
@@ -60,7 +60,7 @@ describe "Dependencies" do
60
60
  Padrino::Reloader.exclude << Padrino.root("fixtures/dependencies/linear/h.rb")
61
61
  Padrino.require_dependencies(
62
62
  Padrino.root("fixtures/dependencies/linear/h.rb"),
63
- Padrino.root("fixtures/dependencies/linear/i.rb"),
63
+ Padrino.root("fixtures/dependencies/linear/i.rb")
64
64
  )
65
65
  end
66
66
  end
@@ -102,7 +102,7 @@ describe "Dependencies" do
102
102
  assert_equal "hello", RRR.hello
103
103
  assert_equal "hello", OOO.hello
104
104
  assert_equal "hello", RollbackTarget.hello
105
- assert_match /Removed constant RollbackTarget from Object/, @io.string
105
+ assert_match(/Removed constant RollbackTarget from Object/, @io.string)
106
106
  end
107
107
  end
108
108
  end
data/test/test_flash.rb CHANGED
@@ -66,7 +66,7 @@ describe Padrino::Flash do
66
66
  end
67
67
  end
68
68
 
69
- routes = Proc.new do
69
+ routes = proc do
70
70
  get :index do
71
71
  params[:key] ? flash[params[:key].to_sym].to_s : flash.now.inspect
72
72
  end
data/test/test_locale.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/helper')
2
2
 
3
3
  describe "Locales" do
4
- Dir[File.expand_path("../../lib/padrino-core/locale/*.yml", __FILE__)].each do |file|
4
+ Dir[File.expand_path('../lib/padrino-core/locale/*.yml', __dir__)].each do |file|
5
5
  base_original = YAML.load_file(file)
6
6
  name = File.basename(file, '.yml')
7
7
  it "should should have correct locale for #{name}" do
data/test/test_logger.rb CHANGED
@@ -75,11 +75,11 @@ describe "PadrinoLogger" do
75
75
  it 'should respond to #write for Rack::CommonLogger' do
76
76
  setup_logger(:log_level => :error)
77
77
  @logger.error "Error message"
78
- assert_match /Error message/, @log.string
78
+ assert_match(/Error message/, @log.string)
79
79
  @logger << "logged anyways"
80
- assert_match /logged anyways/, @log.string
80
+ assert_match(/logged anyways/, @log.string)
81
81
  @logger.write "log via alias"
82
- assert_match /log via alias/, @log.string
82
+ assert_match(/log via alias/, @log.string)
83
83
  end
84
84
 
85
85
  it 'should not blow up on mixed or broken encodings' do
@@ -89,8 +89,8 @@ describe "PadrinoLogger" do
89
89
  @logger.error binary_data
90
90
  @logger.error utf8_data
91
91
  @logger.flush
92
- assert @log.string.include?(utf8_data)
93
- assert @log.string.force_encoding('BINARY').include?(binary_data)
92
+ assert_includes @log.string, utf8_data
93
+ assert_includes @log.string.force_encoding('BINARY'), binary_data
94
94
  end
95
95
 
96
96
  it 'should sanitize mixed or broken encodings if said so' do
@@ -102,8 +102,7 @@ describe "PadrinoLogger" do
102
102
  @logger.error binary_data
103
103
  @logger.error utf8_data
104
104
  @logger.flush
105
- assert @log.string.force_encoding(encoding).include?("?\n".encode(encoding))
106
- assert @log.string.force_encoding(encoding).include?(utf8_data.encode(encoding))
105
+ assert_match(/\.*фыв/m, @log.string.encode(Encoding.default_external))
107
106
  end
108
107
 
109
108
  it 'should log an application' do
@@ -113,7 +112,7 @@ describe "PadrinoLogger" do
113
112
  end
114
113
  get "/"
115
114
  assert_equal "Foo", body
116
- assert_match /GET/, Padrino.logger.log.string
115
+ assert_match(/GET/, Padrino.logger.log.string)
117
116
  end
118
117
 
119
118
  it 'should log an application\'s status code' do
@@ -122,7 +121,7 @@ describe "PadrinoLogger" do
122
121
  get("/"){ "Foo" }
123
122
  end
124
123
  get "/"
125
- assert_match /\e\[1;9m200\e\[0m OK/, Padrino.logger.log.string
124
+ assert_match(/\e\[1;9m200\e\[0m OK/, Padrino.logger.log.string)
126
125
  end
127
126
 
128
127
  describe "static asset logging" do
@@ -144,7 +143,7 @@ describe "PadrinoLogger" do
144
143
  end
145
144
  get "/images/something.png"
146
145
  assert_equal "Foo", body
147
- assert_match /GET/, Padrino.logger.log.string
146
+ assert_match(/GET/, Padrino.logger.log.string)
148
147
  Padrino.logger.instance_eval{ @log_static = false }
149
148
  end
150
149
  end
@@ -161,11 +160,11 @@ describe "PadrinoLogger" do
161
160
  it 'should output under debug level' do
162
161
  Padrino.logger.instance_eval{ @level = Padrino::Logger::Levels[:debug] }
163
162
  access_to_mock_app
164
- assert_match /\e\[0;36m DEBUG\e\[0m/, Padrino.logger.log.string
163
+ assert_match(/\e\[0;36m DEBUG\e\[0m/, Padrino.logger.log.string)
165
164
 
166
165
  Padrino.logger.instance_eval{ @level = Padrino::Logger::Levels[:devel] }
167
166
  access_to_mock_app
168
- assert_match /\e\[0;36m DEBUG\e\[0m/, Padrino.logger.log.string
167
+ assert_match(/\e\[0;36m DEBUG\e\[0m/, Padrino.logger.log.string)
169
168
  end
170
169
 
171
170
  it 'should not output over debug level' do
@@ -208,7 +207,7 @@ describe "alternate logger" do
208
207
  it 'should annotate the logger to support additional Padrino fancyness' do
209
208
  Padrino.logger.debug("Debug message")
210
209
  assert_match(/Debug message/, @log.string)
211
- Padrino.logger.exception(Exception.new 'scary message')
210
+ Padrino.logger.exception(Exception.new('scary message'))
212
211
  assert_match(/Exception - scary message/, @log.string)
213
212
  end
214
213
 
@@ -221,7 +220,7 @@ describe "alternate logger" do
221
220
  end
222
221
  get "/"
223
222
 
224
- assert_match /\e\[1;9m200\e\[0m OK/, @log.string
223
+ assert_match(/\e\[1;9m200\e\[0m OK/, @log.string)
225
224
  end
226
225
  end
227
226
 
@@ -273,7 +272,7 @@ describe "alternate logger: stdlib logger" do
273
272
  end
274
273
  get "/"
275
274
 
276
- assert_match /\e\[1;9m200\e\[0m OK/, @log.string
275
+ assert_match(/\e\[1;9m200\e\[0m OK/, @log.string)
277
276
  end
278
277
  end
279
278
 
@@ -305,7 +304,7 @@ describe "options :colorize_logging" do
305
304
  Padrino::Logger.setup!
306
305
 
307
306
  access_to_mock_app
308
- assert_match /\e\[1;9m200\e\[0m OK/, Padrino.logger.log.string
307
+ assert_match(/\e\[1;9m200\e\[0m OK/, Padrino.logger.log.string)
309
308
  end
310
309
  end
311
310
 
@@ -317,7 +316,7 @@ describe "options :colorize_logging" do
317
316
 
318
317
  it 'should not use colorize logging' do
319
318
  access_to_mock_app
320
- assert_match /200 OK/, Padrino.logger.log.string
319
+ assert_match(/200 OK/, Padrino.logger.log.string)
321
320
  end
322
321
  end
323
322
  end
@@ -335,34 +334,34 @@ describe "options :source_location" do
335
334
 
336
335
  it 'should output source_location if :source_location is set to true' do
337
336
  stub_root { Padrino.logger.debug("hello world") }
338
- assert_match /\[test\/test_logger\.rb:#{__LINE__-1}\] hello world/, Padrino.logger.log.string
337
+ assert_match(/\[test\/test_logger\.rb:#{__LINE__-1}\] hello world/, Padrino.logger.log.string)
339
338
  end
340
339
 
341
340
  it 'should output source_location if file path is relative' do
342
341
  stub_message = "test/test_logger.rb:269:in `test'"
343
342
  Padrino::Logger.logger.stub(:caller, [stub_message]){ stub_root { Padrino.logger.debug("hello relative path") }}
344
- assert_match /\[test\/test_logger\.rb:269\] hello relative path/, Padrino.logger.log.string
343
+ assert_match(/\[test\/test_logger\.rb:269\] hello relative path/, Padrino.logger.log.string)
345
344
  end
346
345
 
347
346
  it 'should not output source_location if :source_location is set to false' do
348
347
  Padrino::Logger::Config[:test][:source_location] = false
349
348
  Padrino::Logger.setup!
350
349
  stub_root { Padrino.logger.debug("hello world") }
351
- assert_match /hello world/, Padrino.logger.log.string
352
- refute_match /\[.+?\] hello world/, Padrino.logger.log.string
350
+ assert_match(/hello world/, Padrino.logger.log.string)
351
+ refute_match(/\[.+?\] hello world/, Padrino.logger.log.string)
353
352
  end
354
353
 
355
354
  it 'should not output source_location unless file path is not started with Padrino.root' do
356
355
  stub_root("/unknown/path/") { Padrino.logger.debug("hello boy") }
357
- assert_match /hello boy/, Padrino.logger.log.string
358
- refute_match /\[.+?\] hello boy/, Padrino.logger.log.string
356
+ assert_match(/hello boy/, Padrino.logger.log.string)
357
+ refute_match(/\[.+?\] hello boy/, Padrino.logger.log.string)
359
358
  end
360
359
 
361
360
  it 'should not output source_location if source file path is started with Padrino.root + vendor' do
362
361
  base_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/')
363
362
  stub_message = File.expand_path(File.dirname(__FILE__) + '/fixtures/vendor/logger.rb') + ":291:in `test'"
364
363
  Padrino::Logger.logger.stub(:caller, [stub_message]) { stub_root(base_path) { Padrino.logger.debug("hello vendor") } }
365
- assert_match /hello vendor/, Padrino.logger.log.string
366
- refute_match /\[.+?\] hello vendor/, Padrino.logger.log.string
364
+ assert_match(/hello vendor/, Padrino.logger.log.string)
365
+ refute_match(/\[.+?\] hello vendor/, Padrino.logger.log.string)
367
366
  end
368
367
  end
data/test/test_mounter.rb CHANGED
@@ -92,7 +92,7 @@ describe "Mounter" do
92
92
  end
93
93
 
94
94
  it 'should raise error when app has no located file' do
95
- # TODO enabling this screws minitest
95
+ # TODO: enabling this screws minitest
96
96
  # assert_raises(Padrino::Mounter::MounterException) { Padrino.mount("tester_app").to('/test') }
97
97
  assert_equal 0, Padrino.mounted_apps.size
98
98
  end
@@ -229,7 +229,7 @@ describe "Mounter" do
229
229
  it 'should not clobber the public setting when mounting an app' do
230
230
  class ::PublicApp < Padrino::Application
231
231
  set :root, "/root"
232
- set :public_folder, File.expand_path(File.dirname(__FILE__))
232
+ set :public_folder, __dir__
233
233
  end
234
234
 
235
235
  Padrino.mount("public_app").to("/public")
@@ -269,7 +269,7 @@ describe "Mounter" do
269
269
  assert_equal "hello sinatra app", res.body
270
270
  res = Rack::MockRequest.new(app).get("/sinatra_app/static.html")
271
271
  assert_equal "hello static file\n", res.body
272
- assert_equal [], RackApp.prerequisites
272
+ assert_empty RackApp.prerequisites
273
273
  end
274
274
 
275
275
  it 'should support the Rack Application with cascading style' do
@@ -36,7 +36,7 @@ describe "Padrino::ParamsProtection" do
36
36
  it 'should work with recursive data' do
37
37
  result = nil
38
38
  mock_app do
39
- post :basic, :params => [ :name, :child => [ :name, :child => [ :name ] ] ] do
39
+ post :basic, :params => [ :name, {:child => [ :name, {:child => [ :name ]} ]} ] do
40
40
  result = [params, original_params]
41
41
  ''
42
42
  end
@@ -54,7 +54,7 @@ describe "Padrino::ParamsProtection" do
54
54
  it 'should be able to process the data' do
55
55
  result = nil
56
56
  mock_app do
57
- post :basic, :params => [ :name, :position => proc{ |v| 'anti-'+v } ] do
57
+ post :basic, :params => [ :name, {:position => proc{ |v| 'anti-'+v }} ] do
58
58
  result = params
59
59
  ''
60
60
  end
@@ -142,7 +142,7 @@ describe "Padrino::ParamsProtection" do
142
142
  post '/persons/destroy/1?' + @jack_query
143
143
  assert_equal({"id"=>"1"}, result)
144
144
  get '/noparam?a=1;b=2'
145
- assert_equal({}, result)
145
+ assert_empty(result)
146
146
  end
147
147
 
148
148
  it 'should successfully filter hashes' do
@@ -165,7 +165,7 @@ describe "Padrino::ParamsProtection" do
165
165
  ''
166
166
  end
167
167
  end
168
- post '/family?' + Padrino::Utils.build_uri_query(:names => %w{Jack Kim Teri})
168
+ post '/family?' + Padrino::Utils.build_uri_query(:names => %w[Jack Kim Teri])
169
169
  assert_equal({"names" => %w[Jack Kim Teri]}, result)
170
170
  end
171
171
 
@@ -190,6 +190,6 @@ describe "Padrino::ParamsProtection" do
190
190
  end
191
191
  end
192
192
  post '/i?gotta=go'
193
- assert_equal({}, result)
193
+ assert_empty(result)
194
194
  end
195
195
  end
@@ -32,13 +32,13 @@ describe "SimpleReloader" do
32
32
  assert_equal 200, status
33
33
  get "/__sinatra__/404.png"
34
34
  assert_equal 200, status
35
- assert_match /image\/png/, response["Content-Type"]
35
+ assert_match(/image\/png/, response["Content-Type"])
36
36
  @app.reset_routes!
37
37
  get "/"
38
38
  assert_equal 404, status
39
39
  get "/__sinatra__/404.png"
40
40
  assert_equal 200, status
41
- assert_match /image\/png/, response["Content-Type"]
41
+ assert_match(/image\/png/, response["Content-Type"])
42
42
  end
43
43
  end
44
44
 
@@ -22,7 +22,7 @@ describe "Padrino::Reloader::Storage" do
22
22
 
23
23
  assert_equal (klasses.size > 1), true
24
24
  klasses.each do |klass|
25
- assert_match /^Padrino::/, klass.to_s
25
+ assert_match(/^Padrino::/, klass.to_s)
26
26
  end
27
27
  end
28
28
  end
data/test/test_routing.rb CHANGED
@@ -1,4 +1,3 @@
1
- #encoding: utf-8
2
1
  require File.expand_path(File.dirname(__FILE__) + '/helper')
3
2
 
4
3
  class FooError < RuntimeError; end
@@ -67,7 +66,7 @@ describe "Routing" do
67
66
  post "/#{File.basename(__FILE__)}?status=422"
68
67
  assert_equal response.status, 422
69
68
  assert_equal File.size(__FILE__).to_s, response['Content-Length']
70
- assert response.headers.include?('Last-Modified')
69
+ assert_includes response.headers, 'Last-Modified'
71
70
  end
72
71
 
73
72
  it 'should ignore trailing delimiters for basic route' do
@@ -146,12 +145,12 @@ describe "Routing" do
146
145
 
147
146
  it 'should accept regexp routes' do
148
147
  mock_app do
149
- get(%r./fob|/baz.) { "regexp" }
148
+ get(%r{/fob|/baz}) { "regexp" }
150
149
  get("/foo") { "str" }
151
- get %r./([0-9]+)/. do |num|
150
+ get %r{/([0-9]+)/} do |num|
152
151
  "Your lucky number: #{num} #{params[:captures].first}"
153
152
  end
154
- get %r./page/([0-9]+)|/. do |num|
153
+ get %r{/page/([0-9]+)|/} do |num|
155
154
  "My lucky number: #{num} #{params[:captures].first}"
156
155
  end
157
156
  end
@@ -169,7 +168,7 @@ describe "Routing" do
169
168
 
170
169
  it 'should ignore trailing slashes' do
171
170
  mock_app do
172
- get(%r./trailing.) { "slash" }
171
+ get(%r{/trailing}) { "slash" }
173
172
  end
174
173
  get "/trailing"
175
174
  assert_equal "slash", body
@@ -306,7 +305,7 @@ describe "Routing" do
306
305
  post(:foo, '', :with => :id){ |id| "/#{id}" }
307
306
  delete(:drugs, :with => [:id, 'destroy']){ |id| "/drugs/#{id}/destroy" }
308
307
  delete(:drugs, '', :with => [:id, 'destroy']){ |id| "/#{id}/destroy" }
309
- get(:splatter, "/splatter/*/*"){ |a, b| url(:splatter, :splat => ["123", "456"]) }
308
+ get(:splatter, "/splatter/*/*"){ |_a, _b| url(:splatter, :splat => ["123", "456"]) }
310
309
  end
311
310
  get "/foo"
312
311
  assert_equal "/foo", body
@@ -519,7 +518,7 @@ describe "Routing" do
519
518
 
520
519
  it 'should send the appropriate number of params' do
521
520
  mock_app do
522
- get('/id/:user_id', :provides => [:json]) { |user_id, format| user_id}
521
+ get('/id/:user_id', :provides => [:json]) { |user_id, _format| user_id}
523
522
  end
524
523
  get '/id/5.json'
525
524
  assert_equal '5', body
@@ -766,7 +765,7 @@ describe "Routing" do
766
765
  assert_equal "js", body
767
766
  get "/b"
768
767
  assert_equal "any", body
769
- # TODO randomly fails in minitest :(
768
+ # TODO: randomly fails in minitest :(
770
769
  # assert_raises(RuntimeError) { get "/b.foo" }
771
770
  get "/c"
772
771
  assert_equal 200, status
@@ -1009,7 +1008,7 @@ describe "Routing" do
1009
1008
  id
1010
1009
  end
1011
1010
 
1012
- get 'format/:id', :provides => [:json, :html] do |id, format|
1011
+ get 'format/:id', :provides => [:json, :html] do |_id, format|
1013
1012
  format
1014
1013
  end
1015
1014
  end
@@ -1958,7 +1957,7 @@ describe "Routing" do
1958
1957
  counter = 0
1959
1958
 
1960
1959
  mock_app do
1961
- self.class.send(:define_method, :increment!) do |*args|
1960
+ self.class.send(:define_method, :increment!) do |*_args|
1962
1961
  condition { counter += 1 }
1963
1962
  end
1964
1963
 
@@ -2142,7 +2141,7 @@ describe "Routing" do
2142
2141
  end
2143
2142
  get "/"
2144
2143
  assert_equal 404, status
2145
- assert_match /not found/, body
2144
+ assert_match(/not found/, body)
2146
2145
  end
2147
2146
 
2148
2147
  it 'should render a custom 404 page using not_found' do
@@ -2246,7 +2245,7 @@ describe "Routing" do
2246
2245
  end
2247
2246
  end
2248
2247
  get "/say/hello/to/world"
2249
- assert_equal %Q[["hello", "world"]], body
2248
+ assert_equal %(["hello", "world"]), body
2250
2249
  end
2251
2250
 
2252
2251
  it "should recognize the route containing splat params if path is ended with slash" do
@@ -2340,7 +2339,7 @@ describe "Routing" do
2340
2339
  env = Rack::MockRequest.env_for("/mock_sample")
2341
2340
  assert_equal :mock_sample, @app.router.recognize(env).first.name
2342
2341
  env = Rack::MockRequest.env_for("/invalid")
2343
- assert_equal [], @app.router.recognize(env)
2342
+ assert_empty @app.router.recognize(env)
2344
2343
  end
2345
2344
 
2346
2345
  it "should be able to use params after sending request" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.3
4
+ version: 0.16.0.pre3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Padrino Team
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2023-02-25 00:00:00.000000000 Z
14
+ date: 2024-08-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: padrino-support
@@ -19,28 +19,42 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.15.3
22
+ version: 0.16.0.pre3
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.15.3
29
+ version: 0.16.0.pre3
30
+ - !ruby/object:Gem::Dependency
31
+ name: rackup
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - "~>"
35
+ - !ruby/object:Gem::Version
36
+ version: '2.1'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '2.1'
30
44
  - !ruby/object:Gem::Dependency
31
45
  name: sinatra
32
46
  requirement: !ruby/object:Gem::Requirement
33
47
  requirements:
34
- - - ">="
48
+ - - "~>"
35
49
  - !ruby/object:Gem::Version
36
- version: 2.2.4
50
+ version: '4'
37
51
  type: :runtime
38
52
  prerelease: false
39
53
  version_requirements: !ruby/object:Gem::Requirement
40
54
  requirements:
41
- - - ">="
55
+ - - "~>"
42
56
  - !ruby/object:Gem::Version
43
- version: 2.2.4
57
+ version: '4'
44
58
  - !ruby/object:Gem::Dependency
45
59
  name: thor
46
60
  requirement: !ruby/object:Gem::Requirement
@@ -203,11 +217,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
203
217
  version: '0'
204
218
  required_rubygems_version: !ruby/object:Gem::Requirement
205
219
  requirements:
206
- - - ">="
220
+ - - ">"
207
221
  - !ruby/object:Gem::Version
208
- version: 1.3.6
222
+ version: 1.3.1
209
223
  requirements: []
210
- rubygems_version: 3.0.8
224
+ rubygems_version: 3.4.19
211
225
  signing_key:
212
226
  specification_version: 4
213
227
  summary: The required Padrino core gem