Sha256: 169b9bce3d1eb7c4695ac93e421ccb9bdf994c31b468dc811b03d06306e920b4

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe 'Student Class Group Enrollments' do

  before { as :admin }

  let(:student) { create(:student, name: 'John', surname: 'Doe') }
  let(:class_group) { create(:class_group, name:'Biology') }
  let!(:el) { '#class-group' }

  before :all do
    set_resource 'student'
  end


  xit 'enrolls to class', js: true do
    student
    class_group
    visit gaku.edit_student_path(student)

    expect do
      click el
      wait_until_visible modal

      select 'Biology', from: 'class_group_enrollment_class_group_id'
      fill_in 'class_group_enrollment_seat_number', with: '77'
      click_on 'Create Class Enrollment'
      #click_on 'Cancel'
      wait_until_invisible modal
    end.to change(Gaku::ClassGroupEnrollment, :count).by 1

    click el
    wait_until_visible '#new-class-group-enrollment-modal'
    within('#new-class-group-enrollment-modal') do
      page.should have_content 'Biology'
      page.should have_content '77'
    end

    visit gaku.edit_student_path(student)
    within(el) do
      page.should have_content 'Biology'
      page.should have_content student.class_groups.last.grade.try(:to_s)
    end
  end


end

Version data entries

3 entries across 3 versions & 1 rubygems

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