Sha256: 1810eec0670235f67b6f7d40446578f7005cb2e70da7f30416039704232cf224

Contents?: true

Size: 1.34 KB

Versions: 5

Compression:

Stored size: 1.34 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 '#student-contacts-menu a'
      page.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 '#student-contacts-menu a'
          page.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 '#student-contacts-menu a'
        page.has_content? 'Contacts list'
      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/contacts_spec.rb
gaku-0.2.3 frontend/spec/features/students/contacts_spec.rb
gaku-0.2.2 frontend/spec/features/students/contacts_spec.rb
gaku-0.2.1 frontend/spec/features/students/contacts_spec.rb
gaku-0.2.0 frontend/spec/features/students/contacts_spec.rb