Sha256: 408bc291562a58291c51b61056e423d57287a1e054bfa8f0091b71aafc1391e4

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe 'Candidate Invite' do

  def create_invitation(attributes = {})
    attributes = {
      :email      => "makers@mark.com",
      :first_name => "Maker's",
      :last_name  => "Mark"
    }.merge(attributes)

    board.candidates.invite(attributes)
  end

  context 'when the email is not already registered' do
    context 'and the invitation is valid' do
      use_vcr_cassette 'candidate invite when valid'

      it 'returns an invitation with the correct attributes' do
        invitation = create_invitation

        invitation.email.should == "makers@mark.com"
      end
    end

    context 'and the invitation is not valid' do
      use_vcr_cassette 'candidate invite when invalid'

      it 'raises an error' do
        expect {
          create_invitation(:email => nil)
        }.to raise_error
      end
    end
  end

  # TODO: should this be considered when the invitation is not valid?
  context 'when the email belongs to an existing user' do
    use_vcr_cassette 'candidate invite email exists'

    it 'raises a conflict error' do
      expect {
        create_invitation(:email => "candidate@recruitmilitary.com")
      }.to raise_error(Board::Client::Conflict)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
board-client-0.99.1 spec/integration/candidates/invite_spec.rb
board-client-0.99.0 spec/integration/candidates/invite_spec.rb