Sha256: ef3f72d8ab75e87aba8a20bd52bf577544b99fb753f98f572ff5b643247d7414

Contents?: true

Size: 921 Bytes

Versions: 3

Compression:

Stored size: 921 Bytes

Contents

require 'test_puppet_helper'

module ForemanPuppet
  module Api
    module V2
      class DummyLookupController < ForemanPuppet::Api::V2::LookupsCommonController
        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

3 entries across 3 versions & 1 rubygems

Version Path
foreman_puppet-0.1.0 test/controllers/foreman_puppet/api/v2/lookups_common_controller_test.rb
foreman_puppet-0.0.2 test/controllers/foreman_puppet/api/v2/lookups_common_controller_test.rb
foreman_puppet-0.0.1 test/controllers/foreman_puppet/api/v2/lookups_common_controller_test.rb