Sha256: 96d6babe47722fd67dd19526dace178ab7851c2f7692310a010145c61b17bfa2

Contents?: true

Size: 734 Bytes

Versions: 87

Compression:

Stored size: 734 Bytes

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

# Tests for the behavior of Ansible Role, currently only validations
class AnsibleRoleTest < ActiveSupport::TestCase
  should have_many(:host_ansible_roles)
  should have_many(:hosts).through(:host_ansible_roles).dependent(:destroy)
  should validate_presence_of(:name)
  context 'with new role' do
    subject { AnsibleRole.new(:name => 'foo') }
    should validate_uniqueness_of(:name)
  end

  test 'should cast default_value to hash' do
    variable = FactoryBot.create(
      :ansible_variable,
      :key_type => 'hash',
      :default_value => "{\r\n  \"bat\": \"man\"\r\n}\r\n",
      :override => true
    )
    assert variable.default_value.is_a?(Hash)
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
foreman_ansible-15.0.2 test/unit/ansible_variable_test.rb
foreman_ansible-15.0.1 test/unit/ansible_variable_test.rb
foreman_ansible-15.0.0 test/unit/ansible_variable_test.rb
foreman_ansible-14.2.2 test/unit/ansible_variable_test.rb
foreman_ansible-14.2.1 test/unit/ansible_variable_test.rb
foreman_ansible-13.0.7 test/unit/ansible_variable_test.rb
foreman_ansible-14.2.0 test/unit/ansible_variable_test.rb
foreman_ansible-14.1.1 test/unit/ansible_variable_test.rb
foreman_ansible-14.1.0 test/unit/ansible_variable_test.rb
foreman_ansible-13.0.5 test/unit/ansible_variable_test.rb
foreman_ansible-14.0.0 test/unit/ansible_variable_test.rb
foreman_ansible-13.0.4 test/unit/ansible_variable_test.rb
foreman_ansible-13.0.3 test/unit/ansible_variable_test.rb
foreman_ansible-13.0.2 test/unit/ansible_variable_test.rb
foreman_ansible-13.0.1 test/unit/ansible_variable_test.rb
foreman_ansible-13.0.0 test/unit/ansible_variable_test.rb
foreman_ansible-12.0.7 test/unit/ansible_variable_test.rb
foreman_ansible-10.4.4 test/unit/ansible_variable_test.rb
foreman_ansible-7.1.8 test/unit/ansible_variable_test.rb
foreman_ansible-12.0.6 test/unit/ansible_variable_test.rb