Sha256: 27fa3d75fbc91e23827a05aa4159807f934a314449d4afe61305a2ea95c41ac5

Contents?: true

Size: 927 Bytes

Versions: 44

Compression:

Stored size: 927 Bytes

Contents

require 'test_puppet_helper'

module ForemanPuppet
  module Api
    module V2
      class DummyLookupController < ForemanPuppet::Api::V2::PuppetLookupsCommonController
        attr_accessor :params
      end

      class LookupsCommonControllerTest < ActiveSupport::TestCase
        setup do
          @dummy = DummyLookupController.new
        end

        test 'should cast default_value from smart class parameter' do
          @dummy.params = { smart_class_parameter: { default_value: %w[a b] } }
          @dummy.cast_value(:smart_class_parameter, :default_value)
          assert_equal %w[a b].to_s, @dummy.params[:smart_class_parameter][:default_value]
        end

        test 'should cast value from override value' do
          @dummy.params = { override_value: { value: 123 } }
          @dummy.cast_value
          assert_equal '123', @dummy.params[:override_value][:value]
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
foreman_puppet-1.0.1 test/controllers/foreman_puppet/api/v2/lookups_common_controller_test.rb
foreman_puppet-1.0.0 test/controllers/foreman_puppet/api/v2/lookups_common_controller_test.rb
foreman_puppet-1.0.0.rc.2 test/controllers/foreman_puppet/api/v2/lookups_common_controller_test.rb
foreman_puppet-1.0.0.rc.1 test/controllers/foreman_puppet/api/v2/lookups_common_controller_test.rb