Sha256: 4a7c81421ef1d4c20da5a06c46e0554ed76022badd2218e65a5f5c15939ff0b9

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

require 'test_helper'
require 'integration_tests_helper'

class InvitationRemoveTest < ActionDispatch::IntegrationTest

  test 'invited user can choose to remove his account/invite' do
    user = User.invite!(:email => "valid@email.com")

    # remove!
    visit remove_user_invitation_path(:invitation_token => Thread.current[:token])
    assert_equal root_path, current_path
    assert page.has_css?('p#notice', :text => 'Your invitation was removed.')
    
    # try to remove again!
    visit remove_user_invitation_path(:invitation_token => Thread.current[:token])
    assert_equal root_path, current_path
    assert page.has_css?('p#alert', :text => 'The invitation token provided is not valid!')
  end

  test 'accepted user cannot remove his account (by using the original invitation token)' do
    user = User.invite!(:email => "valid@email.com")
    saved_token = Thread.current[:token]
    user.accept_invitation!
    
    visit remove_user_invitation_path(:invitation_token =>  saved_token)
    assert_equal root_path, current_path
    assert page.has_css?('p#alert', :text => 'The invitation token provided is not valid!')
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
devise_invitable-1.4.0 test/integration/invitation_remove_test.rb
devise_invitable-1.3.6 test/integration/invitation_remove_test.rb
devise_invitable-1.3.5 test/integration/invitation_remove_test.rb
devise_invitable-1.3.4 test/integration/invitation_remove_test.rb
devise_invitable-1.3.3 test/integration/invitation_remove_test.rb
devise_invitable-1.3.2 test/integration/invitation_remove_test.rb
devise_invitable-1.3.1 test/integration/invitation_remove_test.rb
devise_invitable-1.3.0 test/integration/invitation_remove_test.rb