Sha256: 64fdfafde644dfbdecc715d8809bea506428ffa6b1fdc3271afbc25436168587

Contents?: true

Size: 892 Bytes

Versions: 5

Compression:

Stored size: 892 Bytes

Contents

require 'test_helper'

module Cally
  class InvitationTest < ActiveSupport::TestCase
    
    require 'omw_random_string'

    def setup
      @john = cally_users(:john)
      @invitation = Invitation.new(email: @john.email, invitation_key: OmwRandomString.generate(32))
    end
  
    test 'created invitation in setup is valid (valid)' do
      assert @invitation.valid?
    end

    test 'create new invitation with same email (invalid)' do
      @invitation.save
      invite2 = Invitation.new(email: @john.email, invitation_key: OmwRandomString.generate(32))
      assert_not invite2.valid?
    end

    test 'create invitaion with invalid email address (invalid)' do
      @invitation.email = 'aa.com'
      assert_not @invitation.valid?
    end

    test 'create invitation without email (invalid)' do
      @invitation.email = ''
      assert_not @invitation.valid?
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cally-2.0.0 test/models/cally/invitation_test.rb
cally-1.0.3 test/models/cally/invitation_test.rb
cally-1.0.2 test/models/cally/invitation_test.rb
cally-1.0.1 test/models/cally/invitation_test.rb
cally-1.0.0 test/models/cally/invitation_test.rb