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.36 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.33 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-4.0.35 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.32 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-4.0.32 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-4.0.31 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-4.0.30 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.29 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-4.0.29 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.28 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-5.0.28 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-4.0.27 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.26 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-4.0.26 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-4.0.25.1 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.25 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-4.0.25 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.24.1 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-4.0.24.1 test/controllers/insights_sync/settings_controller_test.rb
foreman_rh_cloud-3.0.24 test/controllers/insights_sync/settings_controller_test.rb