mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix merge conflict and rubocop offences
This commit is contained in:
parent
63f0c04850
commit
165d5b601d
1 changed files with 18 additions and 19 deletions
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "abstract_unit"
|
||||
|
@ -23,16 +22,16 @@ class RoutingAssertionsTest < ActionController::TestCase
|
|||
engine.routes.draw do
|
||||
resources :books
|
||||
|
||||
scope 'secure', :constraints => { :protocol => 'https://' } do
|
||||
resources :books, :controller => 'secure_books'
|
||||
scope "secure", constraints: { protocol: "https://" } do
|
||||
resources :books, controller: "secure_books"
|
||||
end
|
||||
|
||||
scope 'block', :constraints => lambda { |r| r.ssl? } do
|
||||
resources :books, :controller => 'block_books'
|
||||
scope "block", constraints: lambda { |r| r.ssl? } do
|
||||
resources :books, controller: "block_books"
|
||||
end
|
||||
|
||||
scope 'query', :constraints => lambda { |r| r.params[:use_query] == 'true' } do
|
||||
resources :books, :controller => 'query_books'
|
||||
scope "query", constraints: lambda { |r| r.params[:use_query] == "true" } do
|
||||
resources :books, controller: "query_books"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -113,43 +112,43 @@ class RoutingAssertionsTest < ActionController::TestCase
|
|||
end
|
||||
|
||||
def test_assert_recognizes_with_engine
|
||||
assert_recognizes({ :controller => 'books', :action => 'index' }, '/shelf/books')
|
||||
assert_recognizes({ :controller => 'books', :action => 'show', :id => '1' }, '/shelf/books/1')
|
||||
assert_recognizes({ controller: "books", action: "index" }, "/shelf/books")
|
||||
assert_recognizes({ controller: "books", action: "show", id: "1" }, "/shelf/books/1")
|
||||
end
|
||||
|
||||
def test_assert_recognizes_with_engine_and_extras
|
||||
assert_recognizes({ :controller => 'books', :action => 'index', :page => '1' }, '/shelf/books', { :page => '1' })
|
||||
assert_recognizes({ controller: "books", action: "index", page: "1" }, "/shelf/books", page: "1")
|
||||
end
|
||||
|
||||
def test_assert_recognizes_with_engine_and_method
|
||||
assert_recognizes({ :controller => 'books', :action => 'create' }, { :path => '/shelf/books', :method => :post })
|
||||
assert_recognizes({ :controller => 'books', :action => 'update', :id => '1' }, { :path => '/shelf/books/1', :method => :put })
|
||||
assert_recognizes({ controller: "books", action: "create" }, { path: "/shelf/books", method: :post })
|
||||
assert_recognizes({ controller: "books", action: "update", id: "1" }, { path: "/shelf/books/1", method: :put })
|
||||
end
|
||||
|
||||
def test_assert_recognizes_with_engine_and_hash_constraint
|
||||
assert_raise(Assertion) do
|
||||
assert_recognizes({ :controller => 'secure_books', :action => 'index' }, 'http://test.host/shelf/secure/books')
|
||||
assert_recognizes({ controller: "secure_books", action: "index" }, "http://test.host/shelf/secure/books")
|
||||
end
|
||||
assert_recognizes({ :controller => 'secure_books', :action => 'index', :protocol => 'https://' }, 'https://test.host/shelf/secure/books')
|
||||
assert_recognizes({ controller: "secure_books", action: "index", protocol: "https://" }, "https://test.host/shelf/secure/books")
|
||||
end
|
||||
|
||||
def test_assert_recognizes_with_engine_and_block_constraint
|
||||
assert_raise(Assertion) do
|
||||
assert_recognizes({ :controller => 'block_books', :action => 'index' }, 'http://test.host/shelf/block/books')
|
||||
assert_recognizes({ controller: "block_books", action: "index" }, "http://test.host/shelf/block/books")
|
||||
end
|
||||
assert_recognizes({ :controller => 'block_books', :action => 'index' }, 'https://test.host/shelf/block/books')
|
||||
assert_recognizes({ controller: "block_books", action: "index" }, "https://test.host/shelf/block/books")
|
||||
end
|
||||
|
||||
def test_assert_recognizes_with_engine_and_query_constraint
|
||||
assert_raise(Assertion) do
|
||||
assert_recognizes({ :controller => 'query_books', :action => 'index', :use_query => 'false' }, '/shelf/query/books', { :use_query => 'false' })
|
||||
assert_recognizes({ controller: "query_books", action: "index", use_query: "false" }, "/shelf/query/books", use_query: "false")
|
||||
end
|
||||
assert_recognizes({ :controller => 'query_books', :action => 'index', :use_query => 'true' }, '/shelf/query/books', { :use_query => 'true' })
|
||||
assert_recognizes({ controller: "query_books", action: "index", use_query: "true" }, "/shelf/query/books", use_query: "true")
|
||||
end
|
||||
|
||||
def test_assert_recognizes_raises_message_with_engine
|
||||
err = assert_raise(Assertion) do
|
||||
assert_recognizes({ :controller => 'secure_books', :action => 'index' }, 'http://test.host/shelf/secure/books', {}, "This is a really bad msg")
|
||||
assert_recognizes({ controller: "secure_books", action: "index" }, "http://test.host/shelf/secure/books", {}, "This is a really bad msg")
|
||||
end
|
||||
|
||||
assert_match err.message, "This is a really bad msg"
|
||||
|
|
Loading…
Reference in a new issue