Sha256: 7ee694341e472b66da96e010452d73e794d48a40c5afb4ef14a8829855b31a4b

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

describe 'Teacher Contacts' do

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

  let(:teacher) { create(:teacher) }
  let(:teacher_with_contact) { create(:teacher, :with_contact) }
  let(:teacher_with_contacts) { create(:teacher, :with_contacts) }
  let!(:contact_type) { create(:contact_type, name: 'Email') }

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

    before do
      @resource = teacher
      visit gaku.edit_teacher_path(@resource)
      click '#contacts-menu a'
    end

    it_behaves_like 'new contact'
  end

  context 'existing', type: 'contact' do

    context 'one contact' do

      before { @resource = teacher_with_contact }

      context 'edit', js: true do

        before do
          visit gaku.edit_teacher_path(@resource)
          click '#contacts-menu a'
        end

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

    end

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

      before do
        @resource = teacher_with_contacts
        visit gaku.edit_teacher_path(@resource)
        click '#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/other/teachers/contacts_spec.rb
gaku-0.2.3 frontend/spec/features/other/teachers/contacts_spec.rb
gaku-0.2.2 frontend/spec/features/other/teachers/contacts_spec.rb
gaku-0.2.1 frontend/spec/features/other/teachers/contacts_spec.rb
gaku-0.2.0 frontend/spec/features/other/teachers/contacts_spec.rb