Sha256: 4b938fc7cf9aa27647ee7e60658102648a4c1dd271927561e3f7547542c88475

Contents?: true

Size: 910 Bytes

Versions: 10

Compression:

Stored size: 910 Bytes

Contents

require 'test_plugin_helper'

class SettingsControllerTest < ActionController::TestCase
  tests InsightsCloud::SettingsController

  test 'should return allow_auto_insights_sync setting' do
    Setting[:allow_auto_insights_sync] = false

    assert_equal false, Setting[:allow_auto_insights_sync]

    get :show, session: set_session_user

    assert_response :success
    actual = JSON.parse(response.body)
    assert_equal false, actual['insightsSyncEnabled']
  end

  test 'should update allow_auto_insights_sync setting' do
    Setting[:allow_auto_insights_sync] = false

    assert_equal false, Setting[:allow_auto_insights_sync]

    patch :update, params: { insightsSyncEnabled: true }, session: set_session_user

    assert_response :success
    actual = JSON.parse(response.body)
    assert_equal true, actual['insightsSyncEnabled']
    assert_equal true, Setting[:allow_auto_insights_sync]
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
foreman_rh_cloud-5.0.38 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-5.0.37 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-5.0.36 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-5.0.35 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-5.0.34 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-5.0.33 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-5.0.32 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-5.0.31 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-5.0.30 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-5.0.29 test/controllers/insights_sync/settings_controller_test.rb