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
@@ -0,0 +1,140 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gaku::SyllabusesController do
|
4
|
+
|
5
|
+
let(:syllabus) { create(:syllabus) }
|
6
|
+
let(:invalid_syllabus) { create(:invalid_syllabus) }
|
7
|
+
|
8
|
+
context 'as admin' do
|
9
|
+
before { as :admin }
|
10
|
+
|
11
|
+
context 'html' do
|
12
|
+
describe 'GET #index' do
|
13
|
+
before do
|
14
|
+
syllabus
|
15
|
+
gaku_get :index
|
16
|
+
end
|
17
|
+
|
18
|
+
it { should respond_with 200 }
|
19
|
+
it('assigns @syllabuses') { expect(assigns(:syllabuses)).to eq [syllabus] }
|
20
|
+
it('assigns @count') { expect(assigns(:count)).to eq 1 }
|
21
|
+
it('renders :index template') { template? :index }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'js' do
|
26
|
+
|
27
|
+
describe 'XHR #new' do
|
28
|
+
before { gaku_js_get :new }
|
29
|
+
|
30
|
+
it { should respond_with 200 }
|
31
|
+
it('assigns @syllabus') { expect(assigns(:syllabus)).to be_a_new(Gaku::Syllabus) }
|
32
|
+
it('renders the :new template') { template? :new }
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'POST #create' do
|
36
|
+
context 'with valid attributes' do
|
37
|
+
let(:valid_js_create) do
|
38
|
+
gaku_js_post :create, syllabus: attributes_for(:syllabus)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'creates new syllabus' do
|
42
|
+
expect do
|
43
|
+
valid_js_create
|
44
|
+
end.to change(Gaku::Syllabus, :count).by(1)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'renders flash' do
|
48
|
+
valid_js_create
|
49
|
+
flash_created?
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'increments @count' do
|
53
|
+
valid_js_create
|
54
|
+
expect(assigns(:count)).to eq 1
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'with invalid attributes' do
|
59
|
+
let(:invalid_js_create) do
|
60
|
+
gaku_js_post :create, syllabus: attributes_for(:invalid_syllabus)
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'does not save the new syllabus' do
|
64
|
+
expect do
|
65
|
+
invalid_js_create
|
66
|
+
end.to_not change(Gaku::Syllabus, :count)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 're-renders the new method' do
|
70
|
+
invalid_js_create
|
71
|
+
template? :create
|
72
|
+
end
|
73
|
+
|
74
|
+
it "doesn't increment @count" do
|
75
|
+
invalid_js_create
|
76
|
+
expect(assigns(:count)).to eq 0
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe 'XHR #edit' do
|
82
|
+
before { gaku_js_get :edit, id: syllabus }
|
83
|
+
|
84
|
+
it { should respond_with 200 }
|
85
|
+
it('assigns @syllabus') { expect(assigns(:syllabus)).to eq syllabus }
|
86
|
+
it('renders the :edit template') { template? :edit }
|
87
|
+
end
|
88
|
+
|
89
|
+
describe 'PATCH #update' do
|
90
|
+
context 'with valid attributes' do
|
91
|
+
before do
|
92
|
+
gaku_js_patch :update, id: syllabus, syllabus: attributes_for(:syllabus, name: 'mobifon')
|
93
|
+
end
|
94
|
+
|
95
|
+
it { should respond_with 200 }
|
96
|
+
it('assigns @syllabus') { expect(assigns(:syllabus)).to eq syllabus }
|
97
|
+
it('sets flash') { flash_updated? }
|
98
|
+
it "changes syllabus's attributes" do
|
99
|
+
syllabus.reload
|
100
|
+
expect(syllabus.name).to eq 'mobifon'
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context 'with invalid attributes' do
|
105
|
+
before do
|
106
|
+
gaku_js_patch :update, id: syllabus, syllabus: attributes_for(:invalid_syllabus, name: '')
|
107
|
+
end
|
108
|
+
|
109
|
+
it { should respond_with 200 }
|
110
|
+
it('assigns @syllabus') { expect(assigns(:syllabus)).to eq syllabus }
|
111
|
+
|
112
|
+
it "does not change syllabus's attributes" do
|
113
|
+
syllabus.reload
|
114
|
+
expect(syllabus.name).not_to eq ''
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe 'XHR DELETE #destroy' do
|
120
|
+
it 'deletes the syllabus' do
|
121
|
+
syllabus
|
122
|
+
expect do
|
123
|
+
gaku_js_delete :destroy, id: syllabus
|
124
|
+
end.to change(Gaku::Syllabus, :count).by(-1)
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'decrements @count' do
|
128
|
+
gaku_js_delete :destroy, id: syllabus
|
129
|
+
expect(assigns(:count)).to eq 0
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'sets flash' do
|
133
|
+
gaku_js_delete :destroy, id: syllabus
|
134
|
+
flash_destroyed?
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
140
|
+
end
|
@@ -41,7 +41,7 @@ describe 'Admin Roles' do
|
|
41
41
|
|
42
42
|
context 'edit', js: true do
|
43
43
|
before do
|
44
|
-
within('#admin-roles-index tbody tr:nth-child(2)') { click
|
44
|
+
within('#admin-roles-index tbody tr:nth-child(2)') { click js_edit_link }
|
45
45
|
wait_until_visible modal
|
46
46
|
end
|
47
47
|
|
@@ -3,19 +3,15 @@ require 'spec_helper'
|
|
3
3
|
describe 'Admin School Campus Contact' do
|
4
4
|
|
5
5
|
before { as :admin }
|
6
|
+
before(:all) { set_resource 'admin-school-campus-contact' }
|
6
7
|
|
7
8
|
let(:school) { create(:school) }
|
8
|
-
let(:contact_type) { create(:contact_type, name: 'Email') }
|
9
|
-
|
10
|
-
before :all do
|
11
|
-
set_resource 'admin-school-campus-contact'
|
12
|
-
end
|
9
|
+
let!(:contact_type) { create(:contact_type, name: 'Email') }
|
13
10
|
|
14
11
|
context 'new', js: true, type: 'contact' do
|
15
12
|
before do
|
16
|
-
|
17
|
-
|
18
|
-
visit gaku.admin_school_campus_path(school, school.campuses.first)
|
13
|
+
@resource = school.campuses.first
|
14
|
+
visit gaku.admin_school_campus_path(school, @resource)
|
19
15
|
end
|
20
16
|
|
21
17
|
it_behaves_like 'new contact'
|
@@ -27,19 +23,13 @@ describe 'Admin School Campus Contact' do
|
|
27
23
|
before do
|
28
24
|
@school = create(:school_with_one_contact)
|
29
25
|
@school.reload
|
30
|
-
@
|
26
|
+
@resource = @school.campuses.first
|
31
27
|
end
|
32
28
|
|
33
29
|
context 'edit' do
|
34
|
-
before
|
35
|
-
contact_type
|
36
|
-
visit gaku.admin_school_campus_path(@school, @school.campuses.first)
|
37
|
-
end
|
38
|
-
|
30
|
+
before { visit gaku.admin_school_campus_path(@school, @resource) }
|
39
31
|
it_behaves_like 'edit contact'
|
40
|
-
|
41
|
-
it_behaves_like 'delete contact', @data
|
42
|
-
|
32
|
+
it_behaves_like 'delete contact', @resource
|
43
33
|
end
|
44
34
|
end
|
45
35
|
|
@@ -48,14 +38,12 @@ describe 'Admin School Campus Contact' do
|
|
48
38
|
before do
|
49
39
|
@school = create(:school_with_two_contacts)
|
50
40
|
@school.reload
|
51
|
-
@
|
52
|
-
visit gaku.admin_school_campus_path(@school, @
|
41
|
+
@resource = @school.campuses.first
|
42
|
+
visit gaku.admin_school_campus_path(@school, @resource)
|
53
43
|
end
|
54
44
|
|
55
45
|
it_behaves_like 'primary contacts'
|
56
|
-
|
57
46
|
end
|
58
|
-
|
59
|
-
|
60
47
|
end
|
48
|
+
|
61
49
|
end
|
@@ -48,7 +48,7 @@ describe 'Admin Users' do
|
|
48
48
|
|
49
49
|
context 'edit', js: true do
|
50
50
|
before do
|
51
|
-
within("#admin-users-index tbody tr#user-#{user.id}") { click
|
51
|
+
within("#admin-users-index tbody tr#user-#{user.id}") { click js_edit_link }
|
52
52
|
wait_until_visible modal
|
53
53
|
end
|
54
54
|
|
@@ -3,19 +3,15 @@ require 'spec_helper'
|
|
3
3
|
describe 'ClassGroup Notes' do
|
4
4
|
|
5
5
|
before { as :admin }
|
6
|
+
before(:all) { set_resource 'class-group-note' }
|
6
7
|
|
7
8
|
let(:class_group) { create(:class_group) }
|
8
|
-
let(:
|
9
|
-
|
10
|
-
before :all do
|
11
|
-
set_resource 'class-group-note'
|
12
|
-
end
|
9
|
+
let(:class_group_with_note) { create(:class_group, :with_note) }
|
13
10
|
|
14
11
|
context 'new', type: 'note' do
|
15
12
|
before do
|
16
|
-
class_group
|
17
|
-
visit gaku.class_group_path(
|
18
|
-
@data = class_group
|
13
|
+
@resource = class_group
|
14
|
+
visit gaku.class_group_path(@resource)
|
19
15
|
end
|
20
16
|
|
21
17
|
it_behaves_like 'new note'
|
@@ -23,15 +19,12 @@ describe 'ClassGroup Notes' do
|
|
23
19
|
|
24
20
|
context 'existing', js: true, type: 'note' do
|
25
21
|
before do
|
26
|
-
|
27
|
-
visit gaku.class_group_path(
|
28
|
-
@data = class_group
|
22
|
+
@resource = class_group_with_note
|
23
|
+
visit gaku.class_group_path(@resource)
|
29
24
|
end
|
30
25
|
|
31
26
|
it_behaves_like 'edit note'
|
32
|
-
|
33
27
|
it_behaves_like 'delete note'
|
34
|
-
|
35
28
|
end
|
36
29
|
|
37
30
|
end
|