Sha256: 76ace8ea80893b718fcafe15f49fdf55ff9db4050201b274b7c69d0f516ad9b5

Contents?: true

Size: 1.99 KB

Versions: 14

Compression:

Stored size: 1.99 KB

Contents

require 'test_helper'

class ControllerHelpersTest < ActionController::TestCase
  tests ApplicationController

  test "after invite path defaults to after sign in path" do
    assert_equal @controller.send(:after_sign_in_path_for, :user), @controller.after_invite_path_for(:user)
  end

  test "after accept path defaults to after sign in path" do
    assert_equal @controller.send(:after_sign_in_path_for, :user), @controller.after_accept_path_for(:user)
  end

  test 'after invite path is customizable from application controller' do
    custom_path = 'customized/after/invite/path'
    @controller.instance_eval "def after_invite_path_for(resource) '#{custom_path}' end"
    assert_equal @controller.after_invite_path_for(:user), custom_path
  end

  test 'after invite path is customizable from application controller with invited' do
    custom_path = 'customized/after/invite/path'
    @controller.instance_eval "def after_invite_path_for(resource, invited) '#{custom_path}' end"
    assert_equal @controller.after_invite_path_for(:user, :invited), custom_path
  end
  test 'after accept path is customizable from application controller' do
    custom_path = 'customized/after/accept/path'
    @controller.instance_eval "def after_accept_path_for(resource) '#{custom_path}' end"
    assert_equal @controller.after_accept_path_for(:user), custom_path
  end

  test 'is not a devise controller' do
    assert !@controller.devise_controller?
  end

  test 'invitations controller respects definition for after invite path in application controller' do
    assert Devise::InvitationsController.method_defined? :after_invite_path_for
    assert !Devise::InvitationsController.instance_methods(false).include?(:after_invite_path_for)
  end

  test 'invitations controller respects definition for after accept path in application controller' do
    assert Devise::InvitationsController.method_defined? :after_accept_path_for
    assert !Devise::InvitationsController.instance_methods(false).include?(:after_accept_path_for)
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
devise_invitable-2.0.6 test/functional/controller_helpers_test.rb
devise_invitable-2.0.5 test/functional/controller_helpers_test.rb
devise_invitable-2.0.4 test/functional/controller_helpers_test.rb
devise_invitable-2.0.3 test/functional/controller_helpers_test.rb
devise_invitable-2.0.2 test/functional/controller_helpers_test.rb
devise_invitable-2.0.1 test/functional/controller_helpers_test.rb
devise_invitable-2.0.0 test/functional/controller_helpers_test.rb
devise_invitable-1.7.5 test/functional/controller_helpers_test.rb
devise_invitable-1.7.4 test/functional/controller_helpers_test.rb
devise_invitable-1.7.3 test/functional/controller_helpers_test.rb
devise_invitable-1.7.2 test/functional/controller_helpers_test.rb
devise_invitable-1.7.1 test/functional/controller_helpers_test.rb
devise_invitable-1.7.0 test/functional/controller_helpers_test.rb
devise_invitable-1.6.1 test/functional/controller_helpers_test.rb