course_listings_controller_test.rb 483 Bytes
Newer Older
1
2
require 'test_helper'

Zac Wood's avatar
Zac Wood committed
3
class API::CourseListingsControllerTest < ActionDispatch::IntegrationTest
4
  test 'should grab sections for course' do
5
    get course_listings_url course_id: courses(:cs112).id, semester_id: semesters(:fall2018).id
6
    assert_response :success
Zach Perkins's avatar
Zach Perkins committed
7

8
9
    listing_returned = JSON.parse @response.body
    assert listing_returned.size.positive?
Zach Perkins's avatar
Zach Perkins committed
10

11
    assert listing_returned[0].include?("sections")
Zach Perkins's avatar
Zach Perkins committed
12
13

    assert_equal(listing_returned[0]["sections"].length, 2)
14
15
  end
end