Sha256: 3512b279db74f70f6059b811c274b16ca6e8890c63d169efb5650eeabb980d37
Contents?: true
Size: 957 Bytes
Versions: 39
Compression:
Stored size: 957 Bytes
Contents
# frozen_string_literal: true require 'test_plugin_helper' # unit tests for UiRolesImporter class UiRolesImporterTest < ActiveSupport::TestCase setup do changed_roles @importer = ForemanAnsible::UiRolesImporter.new end test 'should create new role' do refute AnsibleRole.find_by(:name => @new_role[:name]) @importer.create_new_roles(@changes['new']) assert AnsibleRole.find_by(:name => @new_role[:name]) end test 'should delete old roles' do assert AnsibleRole.find_by(:name => @role.name) @importer.delete_old_roles(@changes['obsolete']) refute AnsibleRole.find_by(:name => @role.name) end private def changed_roles @role = FactoryBot.create(:ansible_role) new_role_name = 'test_role.foreman' @new_role = { :id => nil, :name => new_role_name } @changes = { 'new' => { 'test_role.foreman' => @new_role.to_json }, 'obsolete' => { @role.name => @role.to_json } } end end
Version data entries
39 entries across 39 versions & 1 rubygems