-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Manage policies and Check compliance buttons for Container Images and others #4206
Changes from all commits
2c9ccc8
b376835
7879ab1
e81fdf3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,9 +126,9 @@ def test_creating(emstype) | |
end | ||
end | ||
|
||
context "#update" do | ||
describe "#update" do | ||
context "updates provider with new token" do | ||
before :each do | ||
before do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😍 😍 😍 |
||
stub_user(:features => :all) | ||
session[:edit] = assigns(:edit) | ||
end | ||
|
@@ -202,8 +202,8 @@ def test_setting_few_fields | |
end | ||
end | ||
|
||
context "#button" do | ||
before(:each) do | ||
describe "#button" do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😍 😍 😍 |
||
before do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😍 😍 😍 |
||
stub_user(:features => :all) | ||
EvmSpecHelper.create_guid_miq_server_zone | ||
end | ||
|
@@ -232,6 +232,57 @@ def test_setting_few_fields | |
post :button, :params => { :pressed => "vm_edit", :format => :js, "check_#{vm.id}" => "1" } | ||
expect(controller.send(:flash_errors?)).not_to be_truthy | ||
end | ||
|
||
context 'displaying nested lists from summary page of container provider' do | ||
let(:provider) { ManageIQ::Providers::ContainerManager.new } | ||
|
||
before do | ||
allow(controller).to receive(:javascript_redirect) | ||
allow(controller).to receive(:performed?).and_return(true) | ||
controller.instance_variable_set(:@display, display) | ||
controller.instance_variable_set(:@_params, :pressed => press, :miq_grid_checks => item.id.to_s, :id => provider.id) | ||
controller.instance_variable_set(:@breadcrumbs, []) | ||
end | ||
|
||
{ | ||
'container_image' => 'Container Images', | ||
'container_replicator' => 'Container Replicators', | ||
'container_node' => 'Container Nodes', | ||
'container_group' => 'Container Pods' | ||
}.each do |display_s, items| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You might not need the hash values, just use an array and then call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But.. what about Container Pods? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you really need it in the testing, or just in the describe/context/it strings? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I removed the hash values and replaced them by an array of four items, I don't know how to set the string for context block properly and nicely (to see there for example 'tagging selected Container Pods' and not 'tagging selected Container Groups'). It's only for this there - for info what is being tested (context). I consider this solution as the easiest and the most readable (at least for now). If something went wrong in some of the specs, we can easily recognize, what went wrong: we will not need to figure out that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
context "displaying #{items}" do | ||
let(:item) { FactoryGirl.create(display_s.to_sym) } | ||
let(:display) { display_s.pluralize } | ||
|
||
context "tagging selected #{items}" do | ||
let(:press) { "#{display_s}_tag" } | ||
|
||
it 'calls tag method with proper model class' do | ||
expect(controller).to receive(:tag).with(display_s.classify.safe_constantize) | ||
controller.send(:button) | ||
end | ||
end | ||
|
||
context "managing policies of selected #{items}" do | ||
let(:press) { "#{display_s}_protect" } | ||
|
||
it 'calls assign_policies method with proper model class' do | ||
expect(controller).to receive(:assign_policies).with(display_s.classify.safe_constantize) | ||
controller.send(:button) | ||
end | ||
end | ||
|
||
context "checking compliance of selected #{items}" do | ||
let(:press) { "#{display_s}_check_compliance" } | ||
|
||
it 'calls check_compliance_nested method with proper model class' do | ||
expect(controller).to receive(:check_compliance_nested).with(display_s.classify.safe_constantize) | ||
controller.send(:button) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
describe "#download_summary_pdf" do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍 😍 😍