Sha256: afe6f674a391b4b445da4ca96ec6fa00c19d87d5adcc715434de97f46b9dd421

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe 'Student Contacts' do

  before { as :admin }

  let(:student) { create(:student) }
  let(:student_with_contact) { create(:student, :with_contact) }
  let(:student_with_contacts) { create(:student, :with_contacts) }
  let!(:contact_type) { create(:contact_type, name: 'Email') }

  before(:all) { set_resource 'student-contact' }

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

    before do
      @resource = student
      visit gaku.edit_student_path(@resource)
      click tab_link
      wait_until { has_content? 'Contacts list' }
    end

    it_behaves_like 'new contact'
  end


  context 'existing', type: 'contact' do

    context 'one contact' do

      before { @resource = student_with_contact }

      context 'edit', js: true do

        before do
          visit gaku.edit_student_path(@resource)
          click tab_link
          wait_until { has_content? 'Contacts list' }
        end

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

    end

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

      before do
        @resource = student_with_contacts
        visit gaku.edit_student_path(@resource)
        click tab_link
        wait_until { has_content? 'Contacts list' }
      end

      it_behaves_like 'primary contacts'
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gaku-0.0.3 core/spec/requests/students/contacts_spec.rb
gaku-0.0.2 core/spec/requests/students/contacts_spec.rb