gaku 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +12 -4
- data/VERSION +1 -1
- data/core/app/controllers/concerns/enrollments_controller.rb +1 -2
- data/core/app/controllers/gaku/contacts_controller.rb +3 -3
- data/core/app/controllers/gaku/notes_controller.rb +33 -24
- data/core/app/controllers/gaku/syllabuses_controller.rb +44 -16
- data/core/app/models/gaku/address.rb +1 -1
- data/core/app/models/gaku/class_group_enrollment.rb +4 -3
- data/core/app/models/gaku/contact.rb +2 -2
- data/core/app/models/gaku/grading_method_set.rb +1 -1
- data/core/app/views/gaku/class_groups/students/enroll_students.js.erb +6 -0
- data/core/app/views/gaku/contacts/_form_fields.html.slim +1 -1
- data/core/app/views/gaku/notes/create.js.erb +3 -3
- data/core/app/views/gaku/notes/destroy.js.erb +3 -3
- data/core/app/views/gaku/notes/edit.js.erb +1 -1
- data/core/app/views/gaku/notes/new.js.erb +1 -1
- data/core/app/views/gaku/notes/show.js.erb +1 -1
- data/core/app/views/gaku/notes/update.js.erb +2 -2
- data/core/app/views/gaku/syllabuses/_syllabus_fields.html.slim +2 -3
- data/core/app/views/gaku/syllabuses/_syllabuses.html.slim +1 -1
- data/core/app/views/gaku/syllabuses/create.js.erb +4 -3
- data/core/app/views/gaku/syllabuses/destroy.js.erb +1 -1
- data/core/app/views/gaku/syllabuses/{show.html.slim → edit.html.slim} +0 -0
- data/core/app/views/gaku/syllabuses/edit.js.erb +1 -1
- data/core/app/views/gaku/syllabuses/new.js.erb +1 -1
- data/core/app/views/gaku/syllabuses/update.js.erb +1 -1
- data/core/config/routes.rb +0 -8
- data/core/gaku_core.gemspec +15 -11
- data/core/lib/gaku/testing/factories/note_factory.rb +4 -0
- data/core/lib/gaku/testing/factories/syllabus_factory.rb +4 -0
- data/core/lib/gaku/testing/request_helpers.rb +5 -0
- data/core/spec/controllers/gaku/addresses_controller_spec.rb +1 -1
- data/core/spec/controllers/gaku/contacts_controller_spec.rb +83 -12
- data/core/spec/controllers/gaku/notes_controller_spec.rb +143 -0
- data/core/spec/controllers/gaku/syllabuses_controller_spec.rb +140 -0
- data/core/spec/requests/admin/achievements/achievements_spec.rb +1 -1
- data/core/spec/requests/admin/grading/grading_method_set_items_spec.rb +1 -1
- data/core/spec/requests/admin/grading/grading_method_sets_spec.rb +1 -1
- data/core/spec/requests/admin/grading/grading_methods_spec.rb +1 -1
- data/core/spec/requests/admin/roles_spec.rb +1 -1
- data/core/spec/requests/admin/school_years/school_years_spec.rb +1 -1
- data/core/spec/requests/admin/school_years/semesters_spec.rb +1 -1
- data/core/spec/requests/admin/schools/campuses/addresses_spec.rb +1 -1
- data/core/spec/requests/admin/schools/campuses/campuses_spec.rb +1 -1
- data/core/spec/requests/admin/schools/campuses/contacts_spec.rb +10 -22
- data/core/spec/requests/admin/schools/programs_spec.rb +1 -1
- data/core/spec/requests/admin/schools/school_levels_spec.rb +1 -1
- data/core/spec/requests/admin/schools/schools_spec.rb +1 -1
- data/core/spec/requests/admin/specialties_spec.rb +1 -1
- data/core/spec/requests/admin/templates_spec.rb +1 -1
- data/core/spec/requests/admin/types_and_methods/attendance_types_spec.rb +1 -1
- data/core/spec/requests/admin/types_and_methods/commute_method_types_spec.rb +1 -1
- data/core/spec/requests/admin/types_and_methods/contact_types_spec.rb +1 -1
- data/core/spec/requests/admin/types_and_methods/enrollment_statuses_spec.rb +1 -1
- data/core/spec/requests/admin/types_and_methods/states_spec.rb +1 -1
- data/core/spec/requests/admin/users_spec.rb +1 -1
- data/core/spec/requests/class_groups/class_groups_spec.rb +1 -1
- data/core/spec/requests/class_groups/notes_spec.rb +6 -13
- data/core/spec/requests/class_groups/semester_class_groups_spec.rb +1 -1
- data/core/spec/requests/course_groups/course_groups_spec.rb +1 -1
- data/core/spec/requests/courses/courses_spec.rb +1 -1
- data/core/spec/requests/courses/notes_spec.rb +6 -11
- data/core/spec/requests/courses/semester_courses_spec.rb +1 -1
- data/core/spec/requests/exams/exam_portions/attachments_spec.rb +1 -1
- data/core/spec/requests/exams/notes_spec.rb +6 -11
- data/core/spec/requests/students/achievements_spec.rb +1 -1
- data/core/spec/requests/students/contacts_spec.rb +7 -7
- data/core/spec/requests/students/guardians/contacts_spec.rb +9 -17
- data/core/spec/requests/students/notes_spec.rb +5 -9
- data/core/spec/requests/students/simple_grades_spec.rb +1 -1
- data/core/spec/requests/students/specialties_spec.rb +1 -1
- data/core/spec/requests/syllabuses/exams_spec.rb +5 -5
- data/core/spec/requests/syllabuses/notes_spec.rb +5 -10
- data/core/spec/requests/syllabuses/syllabuses_spec.rb +46 -85
- data/core/spec/requests/teachers/contacts_spec.rb +11 -19
- data/core/spec/requests/teachers/notes_spec.rb +5 -10
- data/core/spec/support/requests/shared_addresses_spec.rb +6 -2
- data/core/spec/support/requests/shared_contacts_spec.rb +19 -15
- data/core/spec/support/requests/shared_notes_spec.rb +36 -35
- data/gaku_dependencies.rb +1 -8
- metadata +9 -9
- data/core/app/controllers/gaku/assignments_controller.rb +0 -15
- data/core/spec/controllers/gaku/syllabuses/syllabuses_controller_spec.rb +0 -92
| @@ -3,18 +3,15 @@ require 'spec_helper' | |
| 3 3 | 
             
            describe 'Course Notes' do
         | 
| 4 4 |  | 
| 5 5 | 
             
              before { as :admin }
         | 
| 6 | 
            +
              before(:all) { set_resource 'course-note' }
         | 
| 6 7 |  | 
| 7 8 | 
             
              let(:course) { create(:course) }
         | 
| 8 | 
            -
              let(: | 
| 9 | 
            -
             | 
| 10 | 
            -
              before :all do
         | 
| 11 | 
            -
                set_resource 'course-note'
         | 
| 12 | 
            -
              end
         | 
| 9 | 
            +
              let(:course_with_note) { create(:course, :with_note) }
         | 
| 13 10 |  | 
| 14 11 | 
             
              context 'new', js: true, type: 'note'  do
         | 
| 15 12 | 
             
                before do
         | 
| 16 | 
            -
                   | 
| 17 | 
            -
                  @ | 
| 13 | 
            +
                  @resource = course
         | 
| 14 | 
            +
                  visit gaku.course_path(@resource)
         | 
| 18 15 | 
             
                end
         | 
| 19 16 |  | 
| 20 17 | 
             
                it_behaves_like 'new note'
         | 
| @@ -22,13 +19,11 @@ describe 'Course Notes' do | |
| 22 19 |  | 
| 23 20 | 
             
              context 'existing', js: true, type: 'note'  do
         | 
| 24 21 | 
             
                before do
         | 
| 25 | 
            -
                   | 
| 26 | 
            -
                  visit gaku.course_path( | 
| 27 | 
            -
                  @data = course
         | 
| 22 | 
            +
                  @resource = course_with_note
         | 
| 23 | 
            +
                  visit gaku.course_path(@resource)
         | 
| 28 24 | 
             
                end
         | 
| 29 25 |  | 
| 30 26 | 
             
                it_behaves_like 'edit note'
         | 
| 31 | 
            -
             | 
| 32 27 | 
             
                it_behaves_like 'delete note'
         | 
| 33 28 | 
             
              end
         | 
| 34 29 |  | 
| @@ -3,18 +3,15 @@ require 'spec_helper' | |
| 3 3 | 
             
            describe 'Exam Notes' do
         | 
| 4 4 |  | 
| 5 5 | 
             
              before { as :admin }
         | 
| 6 | 
            +
              before(:all) { set_resource 'exam-note' }
         | 
| 6 7 |  | 
| 7 8 | 
             
              let(:exam) { create(:exam) }
         | 
| 8 | 
            -
              let(: | 
| 9 | 
            -
             | 
| 10 | 
            -
              before :all do
         | 
| 11 | 
            -
                set_resource 'exam-note'
         | 
| 12 | 
            -
              end
         | 
| 9 | 
            +
              let(:exam_with_note) { create(:exam, :with_note) }
         | 
| 13 10 |  | 
| 14 11 | 
             
              context 'new', js: true, type: 'note'  do
         | 
| 15 12 | 
             
                before do
         | 
| 16 | 
            -
                   | 
| 17 | 
            -
                  @ | 
| 13 | 
            +
                  @resource = exam
         | 
| 14 | 
            +
                  visit gaku.exam_path(@resource)
         | 
| 18 15 | 
             
                end
         | 
| 19 16 |  | 
| 20 17 | 
             
                it_behaves_like 'new note'
         | 
| @@ -22,13 +19,11 @@ describe 'Exam Notes' do | |
| 22 19 |  | 
| 23 20 | 
             
              context 'existing', js: true, type: 'note'  do
         | 
| 24 21 | 
             
                before do
         | 
| 25 | 
            -
                   | 
| 26 | 
            -
                  visit gaku.exam_path( | 
| 27 | 
            -
                  @data = exam
         | 
| 22 | 
            +
                  @resource = exam_with_note
         | 
| 23 | 
            +
                  visit gaku.exam_path(@resource)
         | 
| 28 24 | 
             
                end
         | 
| 29 25 |  | 
| 30 26 | 
             
                it_behaves_like 'edit note'
         | 
| 31 | 
            -
             | 
| 32 27 | 
             
                it_behaves_like 'delete note'
         | 
| 33 28 | 
             
              end
         | 
| 34 29 |  | 
| @@ -14,8 +14,8 @@ describe 'Student Contacts' do | |
| 14 14 | 
             
              context 'new', js: true, type: 'contact' do
         | 
| 15 15 |  | 
| 16 16 | 
             
                before do
         | 
| 17 | 
            -
                  @ | 
| 18 | 
            -
                  visit gaku.edit_student_path(@ | 
| 17 | 
            +
                  @resource = student
         | 
| 18 | 
            +
                  visit gaku.edit_student_path(@resource)
         | 
| 19 19 | 
             
                  click tab_link
         | 
| 20 20 | 
             
                  wait_until { has_content? 'Contacts list' }
         | 
| 21 21 | 
             
                end
         | 
| @@ -28,18 +28,18 @@ describe 'Student Contacts' do | |
| 28 28 |  | 
| 29 29 | 
             
                context 'one contact' do
         | 
| 30 30 |  | 
| 31 | 
            -
                  before { @ | 
| 31 | 
            +
                  before { @resource = student_with_contact }
         | 
| 32 32 |  | 
| 33 33 | 
             
                  context 'edit', js: true do
         | 
| 34 34 |  | 
| 35 35 | 
             
                    before do
         | 
| 36 | 
            -
                      visit gaku.edit_student_path(@ | 
| 36 | 
            +
                      visit gaku.edit_student_path(@resource)
         | 
| 37 37 | 
             
                      click tab_link
         | 
| 38 38 | 
             
                      wait_until { has_content? 'Contacts list' }
         | 
| 39 39 | 
             
                    end
         | 
| 40 40 |  | 
| 41 41 | 
             
                    it_behaves_like 'edit contact'
         | 
| 42 | 
            -
                    it_behaves_like 'delete contact', @ | 
| 42 | 
            +
                    it_behaves_like 'delete contact', @resource
         | 
| 43 43 | 
             
                  end
         | 
| 44 44 |  | 
| 45 45 | 
             
                end
         | 
| @@ -47,8 +47,8 @@ describe 'Student Contacts' do | |
| 47 47 | 
             
                context 'two contacts', type: 'contact' do
         | 
| 48 48 |  | 
| 49 49 | 
             
                  before do
         | 
| 50 | 
            -
                    @ | 
| 51 | 
            -
                    visit gaku.edit_student_path(@ | 
| 50 | 
            +
                    @resource = student_with_contacts
         | 
| 51 | 
            +
                    visit gaku.edit_student_path(@resource)
         | 
| 52 52 | 
             
                    click tab_link
         | 
| 53 53 | 
             
                    wait_until { has_content? 'Contacts list' }
         | 
| 54 54 | 
             
                  end
         | 
| @@ -3,6 +3,7 @@ require 'spec_helper' | |
| 3 3 | 
             
            describe 'Student Guardian Contacts' do
         | 
| 4 4 |  | 
| 5 5 | 
             
              before { as :admin }
         | 
| 6 | 
            +
              before(:all) { set_resource 'student-guardian-contact' }
         | 
| 6 7 |  | 
| 7 8 | 
             
              let(:student) { create(:student) }
         | 
| 8 9 | 
             
              let(:guardian) { create(:guardian) }
         | 
| @@ -12,17 +13,12 @@ describe 'Student Guardian Contacts' do | |
| 12 13 |  | 
| 13 14 | 
             
              tab_link = '#student-guardian-contacts-tab-link'
         | 
| 14 15 |  | 
| 15 | 
            -
              before :all do
         | 
| 16 | 
            -
                set_resource 'student-guardian-contact'
         | 
| 17 | 
            -
              end
         | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 16 | 
             
              context 'new', js: true, type: 'contact'  do
         | 
| 21 17 | 
             
                before(:each) do
         | 
| 22 18 | 
             
                  contact_type
         | 
| 23 19 | 
             
                  student.guardians << guardian
         | 
| 24 20 | 
             
                  visit gaku.edit_student_path(student)
         | 
| 25 | 
            -
                  @ | 
| 21 | 
            +
                  @resource = guardian
         | 
| 26 22 | 
             
                  click '#student-guardians-tab-link'
         | 
| 27 23 | 
             
                  wait_until { page.has_content? 'Guardians list' }
         | 
| 28 24 | 
             
                  click edit_link
         | 
| @@ -36,27 +32,23 @@ describe 'Student Guardian Contacts' do | |
| 36 32 | 
             
              context 'existing', js: true, type: 'contact' do
         | 
| 37 33 |  | 
| 38 34 | 
             
                context 'one contact' do
         | 
| 39 | 
            -
             | 
| 40 35 | 
             
                  before do
         | 
| 41 | 
            -
                    @ | 
| 42 | 
            -
                    student.guardians << @ | 
| 43 | 
            -
                    visit gaku.edit_student_guardian_path(student, @ | 
| 36 | 
            +
                    @resource = guardian_with_contact
         | 
| 37 | 
            +
                    student.guardians << @resource
         | 
| 38 | 
            +
                    visit gaku.edit_student_guardian_path(student, @resource)
         | 
| 44 39 | 
             
                    click tab_link
         | 
| 45 40 | 
             
                  end
         | 
| 46 41 |  | 
| 47 | 
            -
             | 
| 48 42 | 
             
                  it_behaves_like 'edit contact'
         | 
| 49 | 
            -
             | 
| 50 | 
            -
                  it_behaves_like 'delete contact', @data
         | 
| 51 | 
            -
             | 
| 43 | 
            +
                  it_behaves_like 'delete contact', @resource
         | 
| 52 44 | 
             
                end
         | 
| 53 45 |  | 
| 54 46 | 
             
                context 'two contacts', type: 'contact' do
         | 
| 55 47 |  | 
| 56 48 | 
             
                  before do
         | 
| 57 | 
            -
                    @ | 
| 58 | 
            -
                    student.guardians << @ | 
| 59 | 
            -
                    visit gaku.edit_student_guardian_path(student, @ | 
| 49 | 
            +
                    @resource = guardian_with_contacts
         | 
| 50 | 
            +
                    student.guardians << @resource
         | 
| 51 | 
            +
                    visit gaku.edit_student_guardian_path(student, @resource)
         | 
| 60 52 | 
             
                    click tab_link
         | 
| 61 53 | 
             
                  end
         | 
| 62 54 |  | 
| @@ -3,19 +3,16 @@ require 'spec_helper' | |
| 3 3 | 
             
            describe 'Student Notes' do
         | 
| 4 4 |  | 
| 5 5 | 
             
              before { as :admin }
         | 
| 6 | 
            +
              before(:all) { set_resource 'student-note' }
         | 
| 6 7 |  | 
| 7 8 | 
             
              let(:student) { create(:student) }
         | 
| 8 9 | 
             
              let(:student_with_note) { create(:student, :with_note) }
         | 
| 9 10 | 
             
              let(:note) { create(:note, notable: student) }
         | 
| 10 11 |  | 
| 11 | 
            -
              before :all do
         | 
| 12 | 
            -
                set_resource 'student-note'
         | 
| 13 | 
            -
              end
         | 
| 14 | 
            -
             | 
| 15 12 | 
             
              context 'new', type: 'note'  do
         | 
| 16 13 | 
             
                before do
         | 
| 17 | 
            -
                  @ | 
| 18 | 
            -
                  visit gaku.edit_student_path(@ | 
| 14 | 
            +
                  @resource = student
         | 
| 15 | 
            +
                  visit gaku.edit_student_path(@resource)
         | 
| 19 16 | 
             
                  click tab_link
         | 
| 20 17 | 
             
                end
         | 
| 21 18 |  | 
| @@ -24,13 +21,12 @@ describe 'Student Notes' do | |
| 24 21 |  | 
| 25 22 | 
             
              context 'existing', js: true, type: 'note'  do
         | 
| 26 23 | 
             
                before do
         | 
| 27 | 
            -
                  @ | 
| 28 | 
            -
                  visit gaku.edit_student_path(@ | 
| 24 | 
            +
                  @resource = student_with_note
         | 
| 25 | 
            +
                  visit gaku.edit_student_path(@resource)
         | 
| 29 26 | 
             
                  click tab_link
         | 
| 30 27 | 
             
                end
         | 
| 31 28 |  | 
| 32 29 | 
             
                it_behaves_like 'edit note'
         | 
| 33 | 
            -
             | 
| 34 30 | 
             
                it_behaves_like 'delete note'
         | 
| 35 31 | 
             
              end
         | 
| 36 32 |  | 
| @@ -24,7 +24,7 @@ describe 'Syllabus Exams' do | |
| 24 24 | 
             
                  syllabus
         | 
| 25 25 | 
             
                  visit gaku.syllabuses_path
         | 
| 26 26 |  | 
| 27 | 
            -
                  within('#syllabuses-index tbody tr:nth-child(1)') { click  | 
| 27 | 
            +
                  within('#syllabuses-index tbody tr:nth-child(1)') { click edit_link }
         | 
| 28 28 | 
             
                  page.should have_content 'No Exams'
         | 
| 29 29 | 
             
                end
         | 
| 30 30 |  | 
| @@ -58,7 +58,7 @@ describe 'Syllabus Exams' do | |
| 58 58 | 
             
                  before do
         | 
| 59 59 | 
             
                    syllabus
         | 
| 60 60 | 
             
                    visit gaku.syllabuses_path
         | 
| 61 | 
            -
                    within('#syllabuses-index tbody tr:nth-child(1)') { click  | 
| 61 | 
            +
                    within('#syllabuses-index tbody tr:nth-child(1)') { click edit_link }
         | 
| 62 62 | 
             
                    page.should have_content 'No Exams'
         | 
| 63 63 | 
             
                    click new_link
         | 
| 64 64 | 
             
                    wait_until_visible submit
         | 
| @@ -95,11 +95,11 @@ describe 'Syllabus Exams' do | |
| 95 95 | 
             
                context 'created exam' do
         | 
| 96 96 | 
             
                  before do
         | 
| 97 97 | 
             
                    syllabus.exams << exam
         | 
| 98 | 
            -
                    visit gaku. | 
| 98 | 
            +
                    visit gaku.edit_syllabus_path(syllabus)
         | 
| 99 99 | 
             
                  end
         | 
| 100 100 |  | 
| 101 101 | 
             
                  it 'edits', js: true do
         | 
| 102 | 
            -
                    click  | 
| 102 | 
            +
                    click js_edit_link
         | 
| 103 103 | 
             
                    wait_until_visible modal
         | 
| 104 104 |  | 
| 105 105 | 
             
                    fill_in 'exam_name', with: 'Ruby Exam'
         | 
| @@ -137,7 +137,7 @@ describe 'Syllabus Exams' do | |
| 137 137 | 
             
                before do
         | 
| 138 138 | 
             
                  syllabus
         | 
| 139 139 | 
             
                  visit gaku.syllabuses_path
         | 
| 140 | 
            -
                  within('#syllabuses-index tbody tr:nth-child(1)') { click  | 
| 140 | 
            +
                  within('#syllabuses-index tbody tr:nth-child(1)') { click edit_link }
         | 
| 141 141 | 
             
                end
         | 
| 142 142 |  | 
| 143 143 | 
             
                it 'clicking on new-existing-exam-link hides new-exam form', js: true do
         | 
| @@ -3,19 +3,15 @@ require 'spec_helper' | |
| 3 3 | 
             
            describe 'Syllabus Notes' do
         | 
| 4 4 |  | 
| 5 5 | 
             
              before { as :admin }
         | 
| 6 | 
            +
              before(:all) { set_resource 'syllabus-note' }
         | 
| 6 7 |  | 
| 7 8 | 
             
              let(:syllabus) { create(:syllabus) }
         | 
| 8 9 | 
             
              let(:syllabus_with_note) { create(:syllabus, :with_note) }
         | 
| 9 | 
            -
              let(:note) { create(:note) }
         | 
| 10 | 
            -
             | 
| 11 | 
            -
              before :all do
         | 
| 12 | 
            -
                set_resource 'syllabus-note'
         | 
| 13 | 
            -
              end
         | 
| 14 10 |  | 
| 15 11 | 
             
              context 'new', js: true do
         | 
| 16 12 | 
             
                before do
         | 
| 17 | 
            -
                  @ | 
| 18 | 
            -
                  visit gaku. | 
| 13 | 
            +
                  @resource = syllabus
         | 
| 14 | 
            +
                  visit gaku.edit_syllabus_path(@resource)
         | 
| 19 15 | 
             
                end
         | 
| 20 16 |  | 
| 21 17 | 
             
                it_behaves_like 'new note'
         | 
| @@ -23,12 +19,11 @@ describe 'Syllabus Notes' do | |
| 23 19 |  | 
| 24 20 | 
             
              context 'existing', js: true do
         | 
| 25 21 | 
             
                before do
         | 
| 26 | 
            -
                  @ | 
| 27 | 
            -
                  visit gaku. | 
| 22 | 
            +
                  @resource = syllabus_with_note
         | 
| 23 | 
            +
                  visit gaku.edit_syllabus_path(@resource)
         | 
| 28 24 | 
             
                end
         | 
| 29 25 |  | 
| 30 26 | 
             
                it_behaves_like 'edit note'
         | 
| 31 | 
            -
             | 
| 32 27 | 
             
                it_behaves_like 'delete note'
         | 
| 33 28 | 
             
              end
         | 
| 34 29 |  | 
| @@ -3,14 +3,11 @@ require 'spec_helper' | |
| 3 3 | 
             
            describe 'Syllabus' do
         | 
| 4 4 |  | 
| 5 5 | 
             
              before { as :admin }
         | 
| 6 | 
            +
              before(:all) { set_resource 'syllabus' }
         | 
| 6 7 |  | 
| 7 8 | 
             
              let(:syllabus) { create(:syllabus, name: 'Biology', code: 'bio') }
         | 
| 8 9 |  | 
| 9 | 
            -
               | 
| 10 | 
            -
                set_resource 'syllabus'
         | 
| 11 | 
            -
              end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
              context '#new ', js: true do
         | 
| 10 | 
            +
              context 'new', js: true do
         | 
| 14 11 |  | 
| 15 12 | 
             
                before do
         | 
| 16 13 | 
             
                  visit gaku.syllabuses_path
         | 
| @@ -19,7 +16,6 @@ describe 'Syllabus' do | |
| 19 16 | 
             
                end
         | 
| 20 17 |  | 
| 21 18 | 
             
                it 'creates' do
         | 
| 22 | 
            -
                  tr_count = size_of(table_rows)
         | 
| 23 19 | 
             
                  expect do
         | 
| 24 20 | 
             
                    fill_in 'syllabus_name', with: 'Syllabus1'
         | 
| 25 21 | 
             
                    fill_in 'syllabus_code', with: 'code1'
         | 
| @@ -28,116 +24,81 @@ describe 'Syllabus' do | |
| 28 24 | 
             
                    wait_until_invisible submit
         | 
| 29 25 | 
             
                  end.to change(Gaku::Syllabus, :count).by 1
         | 
| 30 26 |  | 
| 31 | 
            -
                   | 
| 32 | 
            -
                   | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
                it {has_validations?}
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                it 'cancels adding' do
         | 
| 38 | 
            -
                  ensure_cancel_creating_is_working
         | 
| 27 | 
            +
                  has_content? 'Syllabus1'
         | 
| 28 | 
            +
                  has_content? 'code1'
         | 
| 29 | 
            +
                  count? '1'
         | 
| 39 30 | 
             
                end
         | 
| 40 31 |  | 
| 32 | 
            +
                it { has_validations? }
         | 
| 41 33 | 
             
              end
         | 
| 42 34 |  | 
| 43 35 | 
             
              context 'existing' do
         | 
| 44 36 |  | 
| 45 | 
            -
                before  | 
| 46 | 
            -
                  syllabus
         | 
| 47 | 
            -
                  visit gaku.syllabuses_path
         | 
| 48 | 
            -
                end
         | 
| 49 | 
            -
             | 
| 50 | 
            -
                context 'lists' do
         | 
| 37 | 
            +
                before { syllabus }
         | 
| 51 38 |  | 
| 52 | 
            -
             | 
| 53 | 
            -
                    page.should have_content('List Syllabuses')
         | 
| 39 | 
            +
                context 'edit', js: true do
         | 
| 54 40 |  | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
                       | 
| 58 | 
            -
                    end
         | 
| 59 | 
            -
                    size_of(table_rows).should eq 2
         | 
| 60 | 
            -
                  end
         | 
| 41 | 
            +
                  context 'from edit view' do
         | 
| 42 | 
            +
                    xit 'edits' do
         | 
| 43 | 
            +
                      visit gaku.edit_syllabus_path(syllabus)
         | 
| 61 44 |  | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
                  end
         | 
| 45 | 
            +
                      fill_in 'syllabus_name', with: 'Maths'
         | 
| 46 | 
            +
                      fill_in 'syllabus_code', with: 'math'
         | 
| 47 | 
            +
                      fill_in 'syllabus_description', with: 'Maths Description'
         | 
| 66 48 |  | 
| 67 | 
            -
             | 
| 49 | 
            +
                      click submit
         | 
| 50 | 
            +
                      flash_updated?
         | 
| 68 51 |  | 
| 69 | 
            -
             | 
| 52 | 
            +
                      has_content? 'Maths'
         | 
| 53 | 
            +
                      has_content? 'math'
         | 
| 70 54 |  | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            -
                    click edit_link
         | 
| 74 | 
            -
                    wait_until_visible modal
         | 
| 75 | 
            -
                  end
         | 
| 55 | 
            +
                      has_no_content? 'Biology'
         | 
| 56 | 
            +
                      has_no_content? 'bio'
         | 
| 76 57 |  | 
| 77 | 
            -
             | 
| 78 | 
            -
                     | 
| 79 | 
            -
                    has_validations?
         | 
| 58 | 
            +
                      expect(syllabus.reload.name).to eq 'Maths'
         | 
| 59 | 
            +
                    end
         | 
| 80 60 | 
             
                  end
         | 
| 81 61 |  | 
| 82 | 
            -
                   | 
| 83 | 
            -
                     | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
                     | 
| 88 | 
            -
             | 
| 89 | 
            -
                    page.should have_content('Maths')
         | 
| 90 | 
            -
                    page.should have_content('math')
         | 
| 91 | 
            -
             | 
| 92 | 
            -
                    page.should_not have_content 'Biology'
         | 
| 93 | 
            -
                    page.should_not have_content 'bio'
         | 
| 94 | 
            -
             | 
| 95 | 
            -
                    edited_syllabus = Gaku::Syllabus.last
         | 
| 96 | 
            -
                    edited_syllabus.name.should eq 'Maths'
         | 
| 97 | 
            -
                    edited_syllabus.code.should eq 'math'
         | 
| 98 | 
            -
                    edited_syllabus.description.should eq 'Maths Description'
         | 
| 99 | 
            -
                    flash_updated?
         | 
| 100 | 
            -
                  end
         | 
| 62 | 
            +
                  context 'from index view' do
         | 
| 63 | 
            +
                    before do
         | 
| 64 | 
            +
                      visit gaku.syllabuses_path
         | 
| 65 | 
            +
                      click js_edit_link
         | 
| 66 | 
            +
                      wait_until_visible modal
         | 
| 67 | 
            +
                    end
         | 
| 101 68 |  | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 69 | 
            +
                    it 'edits from index' do
         | 
| 70 | 
            +
                      fill_in 'syllabus_name', with: 'Maths'
         | 
| 71 | 
            +
                      fill_in 'syllabus_code', with: 'math'
         | 
| 72 | 
            +
                      fill_in 'syllabus_description', with: 'Maths Description'
         | 
| 105 73 |  | 
| 106 | 
            -
             | 
| 107 | 
            -
                    visit gaku.syllabus_path(syllabus)
         | 
| 108 | 
            -
                    click edit_link
         | 
| 109 | 
            -
                    wait_until_visible modal
         | 
| 74 | 
            +
                      click submit
         | 
| 110 75 |  | 
| 111 | 
            -
             | 
| 112 | 
            -
                    fill_in 'syllabus_code', with: 'math'
         | 
| 113 | 
            -
                    fill_in 'syllabus_description', with: 'Maths Description'
         | 
| 76 | 
            +
                      flash_updated?
         | 
| 114 77 |  | 
| 115 | 
            -
             | 
| 78 | 
            +
                      has_content? 'Maths'
         | 
| 79 | 
            +
                      has_content? 'math'
         | 
| 116 80 |  | 
| 117 | 
            -
             | 
| 118 | 
            -
             | 
| 81 | 
            +
                      has_no_content? 'Biology'
         | 
| 82 | 
            +
                      has_no_content? 'bio'
         | 
| 119 83 |  | 
| 120 | 
            -
             | 
| 121 | 
            -
                     | 
| 84 | 
            +
                      expect(syllabus.reload.name).to eq 'Maths'
         | 
| 85 | 
            +
                    end
         | 
| 122 86 |  | 
| 123 | 
            -
                     | 
| 124 | 
            -
             | 
| 125 | 
            -
             | 
| 126 | 
            -
                     | 
| 127 | 
            -
                    flash_updated?
         | 
| 87 | 
            +
                    it 'has validations' do
         | 
| 88 | 
            +
                      fill_in 'syllabus_name', with: ''
         | 
| 89 | 
            +
                      has_validations?
         | 
| 90 | 
            +
                    end
         | 
| 128 91 | 
             
                  end
         | 
| 129 92 | 
             
                end
         | 
| 130 93 |  | 
| 131 | 
            -
                 | 
| 94 | 
            +
                xit 'deletes', js: true do
         | 
| 132 95 |  | 
| 133 96 | 
             
                  expect do
         | 
| 134 97 | 
             
                    ensure_delete_is_working
         | 
| 135 98 | 
             
                  end.to change(Gaku::Syllabus, :count).by -1
         | 
| 136 99 |  | 
| 137 | 
            -
                   | 
| 138 | 
            -
             | 
| 100 | 
            +
                  has_no_content?("#{syllabus.code}")
         | 
| 139 101 | 
             
                end
         | 
| 140 102 |  | 
| 141 103 | 
             
              end
         | 
| 142 | 
            -
             | 
| 143 104 | 
             
            end
         |