Sha256: 30c57a2a4c7fabc06556d74812e602429718741ee1859d0b44f4145fdc250ddc

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 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 tab_link

    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 tab_link
        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 tab_link
      end

      it_behaves_like 'primary contacts'
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gaku-0.1.1 frontend/spec/features/teachers/contacts_spec.rb
gaku-0.1.0 frontend/spec/features/teachers/contacts_spec.rb
gaku-0.0.3 core/spec/requests/teachers/contacts_spec.rb
gaku-0.0.2 core/spec/requests/teachers/contacts_spec.rb