Skip to content

Commit

Permalink
Removed MiqRolesFeature.none? check
Browse files Browse the repository at this point in the history
Adjusted test to verify that product features are renamed even when there are no MiqRoleFeatures.
  • Loading branch information
h-kataria committed Jun 1, 2020
1 parent b7108ad commit 19856e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ def down
say_with_time 'Adjusting chargeback reports features to explorer views' do
admin_feature = MiqProductFeature.find_or_create_by!(:identifier => 'chargeback_reports')

return if MiqRolesFeature.none?

MiqRolesFeature.where(:miq_product_feature_id => admin_feature.id).each do |feature|
old_feature_ids.each do |id|
MiqRolesFeature.create!(:miq_product_feature_id => id, :miq_user_role_id => feature.miq_user_role_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,16 @@
expect(view_feature4.reload.identifier).to eq('chargeback_report_only')
end

it 'skips feature renaming when no role features are set' do
it 'product feature is renamed when no role features are set' do
migrate

assigned = roles_feature_stub.where(:miq_user_role_id => user_role_id)
expect(assigned.count).to eq(0)

expect(view_feature1.reload.identifier).to eq('chargeback_download_csv')
expect(view_feature2.reload.identifier).to eq('chargeback_download_pdf')
expect(view_feature3.reload.identifier).to eq('chargeback_download_text')
expect(view_feature4.reload.identifier).to eq('chargeback_report_only')
end
end
end
Expand Down

0 comments on commit 19856e9

Please sign in to comment.