From cebcc0b15b5d60ffb540524b5f70df8c9cc52e61 Mon Sep 17 00:00:00 2001 From: Rob Orton Date: Wed, 1 Jul 2015 13:05:25 -0600 Subject: [PATCH] allow course_search end point without catalog enabled fixes CNVS-20972 test plan - go to /api/v1/search/all_courses - it should not 404 Change-Id: Iaafb4ba8f2cecbd558be089e79291f08c80da6aa Reviewed-on: https://gerrit.instructure.com/57553 Tested-by: Jenkins Reviewed-by: Cody Cutrer Reviewed-by: Braden Anderson QA-Review: August Thornton Product-Review: Cosme Salazar --- app/controllers/search_controller.rb | 7 +------ spec/selenium/all_courses_spec.rb | 6 ++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index f353e6a4d29..ec4208070e4 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -181,12 +181,7 @@ class SearchController < ApplicationController # Only return courses that allow self enrollment. Defaults to false. # def all_courses - unless @domain_root_account.feature_enabled?(:course_catalog) - return render status: 404, template: "shared/errors/404_message" - end - - @courses = Course - .where(root_account_id: @domain_root_account) + @courses = Course.where(root_account_id: @domain_root_account) .where(indexed: true) .where(workflow_state: 'available') .order('created_at') diff --git a/spec/selenium/all_courses_spec.rb b/spec/selenium/all_courses_spec.rb index 8c10736eb78..0e7d692c38f 100644 --- a/spec/selenium/all_courses_spec.rb +++ b/spec/selenium/all_courses_spec.rb @@ -40,4 +40,10 @@ describe "course catalog" do courses = course_elements expect(courses.size).to eql 1 end + + it "should work without course catalog" do + Account.default.disable_feature!(:course_catalog) + courses = course_elements + expect(courses.size).to eql 1 + end end