Sha256: a9c1003c2cdd4eb066cdfb509111f91242a8e3626c8468590b2b073b4b8057cc

Contents?: true

Size: 1.12 KB

Versions: 63

Compression:

Stored size: 1.12 KB

Contents

require 'test_plugin_helper'

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

  test 'should return allow_auto_insights_sync setting' do
    FactoryBot.create(:setting, :name => 'allow_auto_insights_sync', :settings_type => "boolean", :category => "Setting::RhCloud", :default => false, :value => 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
    FactoryBot.create(:setting, :name => 'allow_auto_insights_sync', :settings_type => "boolean", :category => "Setting::RhCloud", :default => false, :value => 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

63 entries across 63 versions & 1 rubygems

Version Path
foreman_rh_cloud-4.0.24 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.23 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-4.0.23 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.22 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-4.0.22 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-4.0.21.1 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.21.1 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.21 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.20 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.19 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-2.0.18.1 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.18.1 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-1.0.18 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-2.0.18 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.18 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-1.0.17 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-2.0.17 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.17 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-2.0.16 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-1.0.16 test/controllers/insights_sync/settings_controller_test.rb