Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
schedules
Commits
45df0731
Commit
45df0731
authored
Oct 28, 2018
by
Zac Wood
Browse files
the tests might actually pass now
parent
f444af2e
Pipeline
#3299
passed with stage
in 2 minutes and 9 seconds
Changes
13
Pipelines
1
Show whitespace changes
Inline
Side-by-side
schedules/.rubocop.yml
View file @
45df0731
...
@@ -13,3 +13,6 @@ Style/SymbolArray:
...
@@ -13,3 +13,6 @@ Style/SymbolArray:
Metrics/BlockLength
:
Metrics/BlockLength
:
Enabled
:
false
Enabled
:
false
Style/ClassAndModuleChildren
:
Enabled
:
false
schedules/app/controllers/api/courses_controller.rb
View file @
45df0731
schedules/app/controllers/application_controller.rb
View file @
45df0731
...
@@ -7,7 +7,7 @@ class ApplicationController < ActionController::Base
...
@@ -7,7 +7,7 @@ class ApplicationController < ActionController::Base
@semester
=
if
cookies
.
key?
(
:semester_id
)
@semester
=
if
cookies
.
key?
(
:semester_id
)
Semester
.
find_by
(
id:
cookies
[
:semester_id
])
Semester
.
find_by
(
id:
cookies
[
:semester_id
])
else
else
sem
=
Semester
.
fi
nd_by
(
season:
'Spring'
,
year:
'2019'
)
sem
=
Semester
.
fi
rst
cookies
[
:semester_id
]
=
sem
.
id
cookies
[
:semester_id
]
=
sem
.
id
sem
sem
end
end
...
...
schedules/app/controllers/courses_controller.rb
View file @
45df0731
class
CoursesController
<
ApplicationController
class
CoursesController
<
ApplicationController
before_action
:set_course
before_action
:set_course
def
show
def
show
;
end
end
private
private
...
...
schedules/app/controllers/schedules_controller.rb
View file @
45df0731
...
@@ -21,5 +21,4 @@ class SchedulesController < ApplicationController
...
@@ -21,5 +21,4 @@ class SchedulesController < ApplicationController
# this works(?)
# this works(?)
# recursively build a list of sets containing 1 section from each course chosen
# recursively build a list of sets containing 1 section from each course chosen
end
end
schedules/app/controllers/sessions_controller.rb
View file @
45df0731
...
@@ -21,8 +21,6 @@ class SessionsController < ApplicationController
...
@@ -21,8 +21,6 @@ class SessionsController < ApplicationController
render
json:
@cart
.
to_json
render
json:
@cart
.
to_json
end
end
private
private
def
update_cookie
(
sym
)
def
update_cookie
(
sym
)
...
...
schedules/app/helpers/search_helper.rb
View file @
45df0731
schedules/app/models/course.rb
View file @
45df0731
schedules/app/models/semester.rb
View file @
45df0731
...
@@ -10,6 +10,6 @@ class Semester < ApplicationRecord
...
@@ -10,6 +10,6 @@ class Semester < ApplicationRecord
validates
:season
,
presence:
true
validates
:season
,
presence:
true
def
to_s
def
to_s
return
"
#{
season
}
#{
year
}
"
"
#{
season
}
#{
year
}
"
end
end
end
end
schedules/config/initializers/assets.rb
View file @
45df0731
schedules/config/routes.rb
View file @
45df0731
schedules/test/controllers/api/courses_controller_test.rb
View file @
45df0731
require
'test_helper'
require
'test_helper'
class
API::CoursesControllerTest
<
ActionDispatch
::
IntegrationTest
class
API::CoursesControllerTest
<
ActionDispatch
::
IntegrationTest
semester_id
=
semesters
(
:fall2018
).
id
test
'#index should return all courses'
do
test
'#index should return all courses'
do
get
api_courses_url
get
api_courses_url
assert_response
:success
assert_response
:success
...
...
schedules/test/controllers/api/schedules_controller_test.rb
View file @
45df0731
...
@@ -2,13 +2,13 @@ require 'test_helper'
...
@@ -2,13 +2,13 @@ require 'test_helper'
class
API::SchedulesControllerTest
<
ActionDispatch
::
IntegrationTest
class
API::SchedulesControllerTest
<
ActionDispatch
::
IntegrationTest
test
"should generate schedule"
do
test
"should generate schedule"
do
crn
s
=
[
course_sections
(
:cs112001
).
crn
,
course_sections
(
:cs112002
).
crn
]
id
s
=
[
course_sections
(
:cs112001
).
id
,
course_sections
(
:cs112002
).
id
]
get
"/api/schedules?
crn
s=
#{
crn
s
.
join
(
','
)
}
"
get
"/api/schedules?
section_id
s=
#{
id
s
.
join
(
','
)
}
"
# DTSTAMP and UID lines uniquely identify events, so we can't test against them.
# DTSTAMP and UID lines uniquely identify events, so we can't test against them.
# so remove all the lines starting with them.
# so remove all the lines starting with them.
# the \r characters are also annoying so just remove them too
# the \r characters are also annoying so just remove them too
gen
=
@response
.
body
.
split
(
"
\n
"
).
sel
ect
{
|
line
|
!
line
.
include?
(
"DTSTAMP"
)
&&
!
line
.
include?
(
"UID"
)
}.
join
(
"
\n
"
).
delete
(
"
\r
"
)
gen
=
@response
.
body
.
split
(
"
\n
"
).
rej
ect
{
|
line
|
line
.
include?
(
"DTSTAMP"
)
||
line
.
include?
(
"UID"
)
}.
join
(
"
\n
"
).
delete
(
"
\r
"
)
correct_ical
=
File
.
open
(
"test/test.ics"
).
read
.
delete
(
"
\r
"
)
correct_ical
=
File
.
open
(
"test/test.ics"
).
read
.
delete
(
"
\r
"
)
assert_equal
correct_ical
,
gen
assert_equal
correct_ical
,
gen
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment