Fix deprecation warning: 'Using a dynamic :controller/:action segment in a route is deprecated'

This commit is contained in:
Pedro Paiva 2020-10-06 15:23:54 -03:00 committed by Elliot Winkler
parent 3ad89431f1
commit 543c18bce9
2 changed files with 6 additions and 7 deletions

View File

@ -24,14 +24,13 @@ describe 'shoulda-matchers integrates with Rails' do
write_file 'app/controllers/examples_controller.rb', <<-FILE
class ExamplesController < ApplicationController
def show
@example = 'hello'
def index
head :ok
end
end
FILE
configure_routes_with_single_wildcard_route
configure_routes
end
specify 'in a project that uses the default test framework' do
@ -114,7 +113,7 @@ describe 'shoulda-matchers integrates with Rails' do
class ExamplesControllerTest < ActionController::TestCase
def setup
get :show
get :index
end
should respond_with(:success)
@ -139,7 +138,7 @@ describe 'shoulda-matchers integrates with Rails' do
add_rspec_file 'spec/controllers/examples_controller_spec.rb', <<-FILE
describe ExamplesController, "show" do
before { get :show }
before { get :index }
it { should respond_with(:success) }
end

View File

@ -83,10 +83,10 @@ module AcceptanceTests
end
end
def configure_routes_with_single_wildcard_route
def configure_routes
write_file 'config/routes.rb', <<-FILE
Rails.application.routes.draw do
get ':controller(/:action(/:id(.:format)))'
resources :examples, only: :index
end
FILE
end