mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-09 14:58:05 -05:00
Routes using i18n and tests, moving test helpers to support directory.
This commit is contained in:
22
test/routes/confirmation_routing_test.rb
Normal file
22
test/routes/confirmation_routing_test.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ConfirmationRoutingTest < ActionController::TestCase
|
||||
|
||||
test 'new session route' do
|
||||
assert_routing('/confirmation/new', :controller => 'confirmations', :action => 'new')
|
||||
end
|
||||
|
||||
test 'create confirmation route' do
|
||||
assert_routing({:path => '/confirmation', :method => :post}, {:controller => 'confirmations', :action => 'create'})
|
||||
end
|
||||
|
||||
test 'show confirmation route' do
|
||||
assert_routing('/confirmation', :controller => 'confirmations', :action => 'show')
|
||||
end
|
||||
|
||||
test 'translated confirmation route' do
|
||||
translated_route(:confirmation => 'confirmacao') do
|
||||
assert_routing('/confirmacao/new', :controller => 'confirmations', :action => 'new')
|
||||
end
|
||||
end
|
||||
end
|
||||
26
test/routes/password_routing_test.rb
Normal file
26
test/routes/password_routing_test.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
require 'test_helper'
|
||||
|
||||
class PasswordRoutingTest < ActionController::TestCase
|
||||
|
||||
test 'new password route' do
|
||||
assert_routing('/password/new', :controller => 'passwords', :action => 'new')
|
||||
end
|
||||
|
||||
test 'create password route' do
|
||||
assert_routing({:path => '/password', :method => :post}, {:controller => 'passwords', :action => 'create'})
|
||||
end
|
||||
|
||||
test 'edit password route' do
|
||||
assert_routing('/password/edit', :controller => 'passwords', :action => 'edit')
|
||||
end
|
||||
|
||||
test 'update password route' do
|
||||
assert_routing({:path => '/password', :method => :put}, {:controller => 'passwords', :action => 'update'})
|
||||
end
|
||||
|
||||
test 'translated password route' do
|
||||
translated_route(:password => 'senha') do
|
||||
assert_routing('/senha/new', :controller => 'passwords', :action => 'new')
|
||||
end
|
||||
end
|
||||
end
|
||||
22
test/routes/session_routing_test.rb
Normal file
22
test/routes/session_routing_test.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
require 'test_helper'
|
||||
|
||||
class SessionRoutingTest < ActionController::TestCase
|
||||
|
||||
test 'new session route' do
|
||||
assert_routing('/session/new', :controller => 'sessions', :action => 'new')
|
||||
end
|
||||
|
||||
test 'create session route' do
|
||||
assert_routing({:path => '/session', :method => :post}, {:controller => 'sessions', :action => 'create'})
|
||||
end
|
||||
|
||||
test 'destroy session route' do
|
||||
assert_routing({:path => '/session', :method => :delete}, {:controller => 'sessions', :action => 'destroy'})
|
||||
end
|
||||
|
||||
test 'translate session route' do
|
||||
translated_route(:session => 'sessao') do
|
||||
assert_routing('/sessao/new', :controller => 'sessions', :action => 'new')
|
||||
end
|
||||
end
|
||||
end
|
||||
12
test/support/controller_tests_helper.rb
Normal file
12
test/support/controller_tests_helper.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
class ActionController::TestCase
|
||||
|
||||
def translated_route(translation={}, &block)
|
||||
I18n.locale = :'pt-BR'
|
||||
I18n.backend.store_translations(:'pt-BR', :devise => { :routes => translation })
|
||||
ActionController::Routing::Routes.reload!
|
||||
yield
|
||||
I18n.locale = :en
|
||||
I18n.reload!
|
||||
ActionController::Routing::Routes.reload!
|
||||
end
|
||||
end
|
||||
@@ -2,15 +2,9 @@ RAILS_ENV = ENV["RAILS_ENV"] = "test"
|
||||
require File.join(File.dirname(__FILE__), 'rails_app', 'config', 'environment')
|
||||
|
||||
require 'test_help'
|
||||
|
||||
require 'webrat'
|
||||
|
||||
require 'assertions_helper'
|
||||
require 'models_helper'
|
||||
require 'integration_tests_helper'
|
||||
|
||||
#ActiveSupport::Dependencies.load_paths << File.expand_path(File.dirname(__FILE__) + '/..')
|
||||
#require_dependency 'devise'
|
||||
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
||||
|
||||
ActionMailer::Base.delivery_method = :test
|
||||
ActionMailer::Base.perform_deliveries = true
|
||||
|
||||
Reference in New Issue
Block a user