Sha256: 5f9d3ddb058d9d3b326e135798e0d597a50a721f994a0db217825dce644057e4

Contents?: true

Size: 1.67 KB

Versions: 69

Compression:

Stored size: 1.67 KB

Contents

require 'test/test_helper'

class RoutesTest < ActionController::TestCase
  tests ApplicationController

  def test_path_and_url(name, prepend_path=nil)
    @request.path = '/users/session'
    prepend_path = "#{prepend_path}_" if prepend_path

    # Resource param
    assert_equal @controller.send(:"#{prepend_path}#{name}_path", :user),
                 send(:"#{prepend_path}user_#{name}_path")
    assert_equal @controller.send(:"#{prepend_path}#{name}_url", :user),
                 send(:"#{prepend_path}user_#{name}_url")

    # Default url params
    assert_equal @controller.send(:"#{prepend_path}#{name}_path", :user, :param => 123),
                 send(:"#{prepend_path}user_#{name}_path", :param => 123)
    assert_equal @controller.send(:"#{prepend_path}#{name}_url", :user, :param => 123),
                 send(:"#{prepend_path}user_#{name}_url", :param => 123)

    @request.path = nil
    # With an AR object
    assert_equal @controller.send(:"#{prepend_path}#{name}_path", User.new),
                 send(:"#{prepend_path}user_#{name}_path")
    assert_equal @controller.send(:"#{prepend_path}#{name}_url", User.new),
                 send(:"#{prepend_path}user_#{name}_url")
  end


  test 'should alias session to mapped user session' do
    test_path_and_url :session
    test_path_and_url :session, :new
    test_path_and_url :session, :destroy
  end

  test 'should alias password to mapped user password' do
    test_path_and_url :password
    test_path_and_url :password, :new
    test_path_and_url :password, :edit
  end

  test 'should alias confirmation to mapped user confirmation' do
    test_path_and_url :confirmation
    test_path_and_url :confirmation, :new
  end
end

Version data entries

69 entries across 64 versions & 9 rubygems

Version Path
graffititracker_devise-1.0.11 test/controllers/url_helpers_test.rb
devise-1.0.11 test/controllers/url_helpers_test.rb
devise-1.0.10 test/controllers/url_helpers_test.rb
devise_ennder-1.4.1.0.9 test/rails_app/vendor/plugins/devise/test/controllers/url_helpers_test.rb
devise_ennder-1.4.1.0.9 test/controllers/url_helpers_test.rb
devise_ennder-1.3.1.0.9 test/rails_app/vendor/plugins/devise/test/controllers/url_helpers_test.rb
devise_ennder-1.3.1.0.9 test/controllers/url_helpers_test.rb
devise_ennder-1.2.1.0.9 test/controllers/url_helpers_test.rb
devise_ennder-1.2.1.0.9 test/rails_app/vendor/plugins/devise/test/controllers/url_helpers_test.rb
devise_ennder-1.1.1.0.9 test/rails_app/vendor/plugins/devise/test/controllers/url_helpers_test.rb
devise_ennder-1.1.1.0.9 test/controllers/url_helpers_test.rb
devise_ennder-1.0.1.0.9 test/rails_app/vendor/plugins/devise/test/controllers/url_helpers_test.rb
devise_ennder-1.0.1.0.9 test/controllers/url_helpers_test.rb
devise-1.0.9 test/controllers/url_helpers_test.rb
dcu-devise-1.0.7 test/controllers/url_helpers_test.rb
devise-1.0.8 test/controllers/url_helpers_test.rb
ivanvc-devise-1.0.7.1 test/controllers/url_helpers_test.rb
mongoid-devise-1.0.1 test/controllers/url_helpers_test.rb
devise-1.0.7 test/controllers/url_helpers_test.rb
devise-1.0.6 test/controllers/url_helpers_test.rb