Sha256: 458c9744331fb2f2d61a73a8fc362fd49a9a820336ad23459f78a1be8d18d12e

Contents?: true

Size: 1.4 KB

Versions: 5

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe 'Student Guardian Contacts' do

  before(:all) { set_resource 'guardian-contact' }
  before { as :admin }

  let(:student) { create(:student) }
  let(:guardian) { create(:guardian) }
  let(:guardian_with_contact) { create(:guardian, :with_contact) }
  let(:guardian_with_contacts) { create(:guardian, :with_contacts) }
  let(:contact_type) { create(:contact_type, name: 'Email') }

  context 'new', js: true, type: 'contact'  do
    before(:each) do
      contact_type
      student.guardians << guardian
      @resource = guardian
      visit gaku.edit_student_guardian_path(student, @resource)
      click '#guardian-contacts-menu a'
    end

    it_behaves_like 'new contact'
  end

  context 'existing', js: true, type: 'contact' do

    context 'one contact' do
      before do
        @resource = guardian_with_contact
        student.guardians << @resource
        visit gaku.edit_student_guardian_path(student, @resource)
        click '#guardian-contacts-menu a'
      end

      it_behaves_like 'edit contact'
      it_behaves_like 'delete contact', @resource
    end

    context 'two contacts', type: 'contact' do

      before do
        @resource = guardian_with_contacts
        student.guardians << @resource
        visit gaku.edit_student_guardian_path(student, @resource)
        click '#guardian-contacts-menu a'
      end

      it_behaves_like 'primary contacts'
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gaku-0.2.4 frontend/spec/features/students/guardians/contacts_spec.rb
gaku-0.2.3 frontend/spec/features/students/guardians/contacts_spec.rb
gaku-0.2.2 frontend/spec/features/students/guardians/contacts_spec.rb
gaku-0.2.1 frontend/spec/features/students/guardians/contacts_spec.rb
gaku-0.2.0 frontend/spec/features/students/guardians/contacts_spec.rb