schedules_controller_test.rb 694 Bytes
Newer Older
1
2
require 'test_helper'

Zac Wood's avatar
Zac Wood committed
3
class API::SchedulesControllerTest < ActionDispatch::IntegrationTest
4
  test "should generate schedule" do
5
    crns = [course_sections(:cs112001).crn, course_sections(:cs112002).crn]
6
    get "/api/schedules?crns=#{crns.join(',')}"
7
8
9
10

    # DTSTAMP and UID lines uniquely identify events, so we can't test against them.
    # so remove all the lines starting with them.
    # the \r characters are also annoying so just remove them too
Zac Wood's avatar
Zac Wood committed
11
12
    gen = @response.body.split("\n").select { |line| !line.include?("DTSTAMP") && !line.include?("UID") }.join("\n").delete("\r")
    correct_ical = File.open("test/test.ics").read.delete("\r")
13
    assert_equal correct_ical, gen
14
15
  end
end