mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
Some major changes.
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
require 'test/test_helper'
|
||||
|
||||
class DeviseHelperTest < ActionView::TestCase
|
||||
|
||||
def store_translations(translations={})
|
||||
I18n.locale = :'pt-BR'
|
||||
I18n.backend.store_translations(:'pt-BR', :devise => { :links => translations })
|
||||
end
|
||||
|
||||
def teardown
|
||||
I18n.locale = :en
|
||||
I18n.reload!
|
||||
end
|
||||
|
||||
test 'should generate a link to sign in' do
|
||||
self.stubs(:new_session_path).returns(new_user_session_path)
|
||||
assert_equal %[<a href="#{new_user_session_path}">Sign in</a>], link_to_sign_in
|
||||
end
|
||||
|
||||
test 'should use i18n to translante sign in link' do
|
||||
self.stubs(:new_session_path).returns(new_user_session_path)
|
||||
store_translations(:sign_in => 'Login')
|
||||
assert_equal %[<a href="#{new_user_session_path}">Login</a>], link_to_sign_in
|
||||
end
|
||||
|
||||
test 'should generate a link to forgot password' do
|
||||
self.stubs(:new_password_path).returns(new_user_password_path)
|
||||
assert_equal %[<a href="#{new_user_password_path}">Forgot password?</a>], link_to_new_password
|
||||
end
|
||||
|
||||
test 'should use i18n to translante forgot password link' do
|
||||
self.stubs(:new_password_path).returns(new_user_password_path)
|
||||
store_translations(:new_password => 'New password?')
|
||||
assert_equal %[<a href="#{new_user_password_path}">New password?</a>], link_to_new_password
|
||||
end
|
||||
|
||||
test 'should generate a link to confirmation instructions' do
|
||||
self.stubs(:new_confirmation_path).returns(new_user_confirmation_path)
|
||||
assert_equal %[<a href="#{new_user_confirmation_path}">Didn't receive confirmation instructions?</a>], link_to_new_confirmation
|
||||
end
|
||||
|
||||
test 'should use i18n to translante confirmation link' do
|
||||
self.stubs(:new_confirmation_path).returns(new_user_confirmation_path)
|
||||
store_translations(:new_confirmation => 'New confirmation?')
|
||||
assert_equal %[<a href="#{new_user_confirmation_path}">New confirmation?</a>], link_to_new_confirmation
|
||||
end
|
||||
end
|
||||
@@ -37,5 +37,5 @@ Rails::Initializer.run do |config|
|
||||
|
||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
|
||||
# config.i18n.default_locale = :de
|
||||
end
|
||||
# config.i18n.default_locale = :en
|
||||
end
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||
|
||||
# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
|
||||
# Rails.backtrace_cleaner.remove_silencers!
|
||||
@@ -1,10 +0,0 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new inflection rules using the following format
|
||||
# (all these examples are active by default):
|
||||
# ActiveSupport::Inflector.inflections do |inflect|
|
||||
# inflect.plural /^(ox)$/i, '\1en'
|
||||
# inflect.singular /^(ox)en/i, '\1'
|
||||
# inflect.irregular 'person', 'people'
|
||||
# inflect.uncountable %w( fish sheep )
|
||||
# end
|
||||
@@ -1,5 +0,0 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
# Mime::Type.register "text/richtext", :rtf
|
||||
# Mime::Type.register_alias "text/html", :iphone
|
||||
@@ -1,7 +0,0 @@
|
||||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
||||
# Major.create(:name => 'Daley', :city => cities.first)
|
||||
7
test/rails_app/test/fixtures/users.yml
vendored
7
test/rails_app/test/fixtures/users.yml
vendored
@@ -1,7 +0,0 @@
|
||||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
||||
|
||||
# one:
|
||||
# column: value
|
||||
#
|
||||
# two:
|
||||
# column: value
|
||||
@@ -1,8 +0,0 @@
|
||||
require 'test_helper'
|
||||
|
||||
class UserTest < ActiveSupport::TestCase
|
||||
# Replace this with your real tests.
|
||||
test "the truth" do
|
||||
assert true
|
||||
end
|
||||
end
|
||||
@@ -14,12 +14,6 @@ class SessionRoutingTest < ActionController::TestCase
|
||||
assert_recognizes({:controller => 'sessions', :action => 'destroy'}, {:path => 'users/session', :method => :delete})
|
||||
end
|
||||
|
||||
test 'translate session route' do
|
||||
translated_route(:session => 'sessao') do
|
||||
assert_recognizes({:controller => 'sessions', :action => 'new'}, 'users/sessao/new')
|
||||
end
|
||||
end
|
||||
|
||||
test 'new admin session route' do
|
||||
assert_recognizes({:controller => 'sessions', :action => 'new'}, 'admin_area/session/new')
|
||||
end
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
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
|
||||
Reference in New Issue
Block a user