• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MarkUsProject / Markus / 20143075828

11 Dec 2025 06:18PM UTC coverage: 91.513%. Remained the same
20143075828

Pull #7763

github

web-flow
Merge 9f55e660a into 3421ef3b2
Pull Request #7763: Release 2.9.0

914 of 1805 branches covered (50.64%)

Branch coverage included in aggregate %.

1584 of 1666 new or added lines in 108 files covered. (95.08%)

573 existing lines in 35 files now uncovered.

43650 of 46892 relevant lines covered (93.09%)

121.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.23
/app/controllers/admin/courses_controller.rb
1
module Admin
1✔
2
  class CoursesController < ApplicationController
1✔
3
    include AutomatedTestsHelper::AutotestApi
1✔
4

5
    DEFAULT_FIELDS = [:id, :name, :is_hidden, :display_name].freeze
1✔
6
    before_action { authorize! }
43✔
7

8
    respond_to :html
1✔
9
    layout 'assignment_content'
1✔
10

11
    def index
1✔
12
      respond_to do |format|
3✔
13
        format.html
3✔
14
        format.json { render json: Course.order(:created_at).to_json(only: DEFAULT_FIELDS) }
5✔
15
      end
16
    end
17

18
    def new
1✔
19
      @current_course = Course.new
1✔
20
    end
21

22
    def create
1✔
23
      @current_course = Course.create(course_create_params)
4✔
24
      update_autotest_url if @current_course.persisted?
4✔
25
      respond_with @current_course, location: -> { admin_courses_path }
7✔
26
    end
27

28
    def edit
1✔
29
      @lti_deployments = @current_course.lti_deployments
1✔
30
    end
31

32
    def update
1✔
33
      current_course.update(course_update_params)
5✔
34
      update_autotest_url
5✔
35
      respond_with @current_course, location: -> { edit_admin_course_path(@current_course) }
9✔
36
    end
37

38
    def test_autotest_connection
1✔
39
      settings = current_course.autotest_setting
5✔
40
      return head :unprocessable_content unless settings&.url
5✔
41
      begin
42
        get_schema(current_course.autotest_setting)
4✔
43
        flash_now(:success, I18n.t('automated_tests.manage_connection.test_success', url: settings.url))
2✔
44
      rescue JSON::ParserError
45
        flash_now(:error, I18n.t('automated_tests.manage_connection.test_schema_failure', url: settings.url))
1✔
46
      rescue StandardError => e
47
        flash_now(:error, I18n.t('automated_tests.manage_connection.test_failure', url: settings.url, error: e.to_s))
1✔
48
      end
49
      head :ok
4✔
50
    end
51

52
    def reset_autotest_connection
1✔
53
      settings = current_course.autotest_setting
2✔
54
      return head :unprocessable_content unless settings&.url
2✔
55
      @current_job = AutotestResetUrlJob.perform_later(current_course,
1✔
56
                                                       settings.url,
57
                                                       request.protocol + request.host_with_port,
58
                                                       refresh: true)
59
      session[:job_id] = @current_job.job_id if @current_job
1✔
60
      respond_with current_course, location: -> { edit_admin_course_path(current_course) }
2✔
61
    end
62

63
    def destroy_lti_deployment
1✔
UNCOV
64
      deployment = LtiDeployment.find(params[:lti_deployment_id])
×
65
      deployment.destroy!
×
66
      redirect_to edit_admin_course_path(@current_course)
×
67
    end
68

69
    private
1✔
70

71
    def course_create_params
1✔
72
      params.require(:course).permit(:name, :is_hidden, :display_name, :max_file_size)
4✔
73
    end
74

75
    def course_update_params
1✔
76
      params.require(:course).permit(:is_hidden, :display_name, :max_file_size)
5✔
77
    end
78

79
    def update_autotest_url
1✔
80
      url = params.require(:course).permit(:autotest_url)[:autotest_url]
8✔
81
      @current_job = AutotestResetUrlJob.perform_later(current_course, url, request.protocol + request.host_with_port)
8✔
82
      session[:job_id] = @current_job.job_id if @current_job
8✔
83
    end
84

85
    def flash_interpolation_options
1✔
86
      { resource_name: @current_course.name.presence || @current_course.model_name.human,
10✔
87
        errors: @current_course.errors.full_messages.join('; ') }
88
    end
89
  end
90
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc