提交 996092ec 编写于 作者: Y yuuji.yaginuma

register rake options to `OptionParser`

In order to prevent `OptionParser::ParseError` when specify the rake options to
`routes` task.
上级 9fa07095
......@@ -19,6 +19,9 @@ task routes: :environment do
OptionParser.new do |opts|
opts.banner = "Usage: rails routes [options]"
Rake.application.standard_rake_options.each { |args| opts.on(*args) }
opts.on("-c CONTROLLER") do |controller|
routes_filter = { controller: controller }
end
......
......@@ -228,6 +228,17 @@ def test_rails_routes_displays_message_when_no_routes_are_defined
MESSAGE
end
def test_rake_routes_with_rake_options
app_file "config/routes.rb", <<-RUBY
Rails.application.routes.draw do
get '/cart', to: 'cart#show'
end
RUBY
output = Dir.chdir(app_path){ `bin/rake --rakefile Rakefile routes` }
assert_equal "Prefix Verb URI Pattern Controller#Action\n cart GET /cart(.:format) cart#show\n", output
end
def test_logger_is_flushed_when_exiting_production_rake_tasks
add_to_config <<-RUBY
rake_tasks do
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册