Skip to content

Commit

Permalink
Merge pull request #14812 from jntullo/bug/miq_group_migration_fix
Browse files Browse the repository at this point in the history
Fix Migration Spec
  • Loading branch information
bdunne authored Apr 19, 2017
2 parents 9722d1d + d4a49b4 commit 7fa0de3
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions spec/migrations/20150904181202_miq_groups_add_ldap_role_spec.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
require_migration

describe MiqGroupsAddLdapRole do
let(:miq_user_role_stub) { migration_stub(:MiqUserRole) }
let(:miq_group_stub) { migration_stub(:MiqGroup) }
migration_context :up do
let(:miq_user_role_stub) { migration_stub(:MiqUserRole) }
let(:miq_group_stub) { migration_stub(:MiqGroup) }

it "migrates ldap groups" do
role = miq_user_role_stub.create!("EvmRole-my_group")
unchanged_group = miq_group_stub.create!(:description => "EvmGroup-super_administrator", :group_type => "abc")
changed_group = miq_group_stub.create!(:description => "EvmGroup-my_group", :group_type => "ldap")
it "migrates ldap groups" do
role = miq_user_role_stub.create!(:name => "EvmRole-my_group")
unchanged_group = miq_group_stub.create!(:description => "EvmGroup-super_administrator", :group_type => "abc")
changed_group = miq_group_stub.create!(:description => "EvmGroup-my_group", :group_type => "ldap")

migrate
changed_group.reload
migrate
changed_group.reload

expect(unchanged_group.reload.group_type).to eq("abc")
expect(changed_group.group_type).to eq("system")
expect(changed_group.role).to eq(role)
expect(unchanged_group.reload.group_type).to eq("abc")
expect(changed_group.group_type).to eq("system")
expect(changed_group.miq_user_role_id).to eq(role.id)
end
end
end

0 comments on commit 7fa0de3

Please sign in to comment.