Skip to content

Commit

Permalink
Addressed rubocop comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
h-kataria committed Mar 20, 2018
1 parent f583a7e commit 815162f
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions spec/controllers/host_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,32 @@
it "renders show_list and does not include hidden column" do
allow(controller).to receive(:render)
report = FactoryGirl.create(:miq_report,
:name => 'Hosts',
:title => 'Hosts',
:cols => ['name', 'ipaddress', 'v_total_vms'],
:col_order => ['name', 'ipaddress', 'v_total_vms'],
:headers => ['Name', 'IP Address', 'VMs'],
:col_options => {"name" => {:hidden=>true}}
)
:name => 'Hosts',
:title => 'Hosts',
:cols => %w(name ipaddress v_total_vms),
:col_order => %w(name ipaddress v_total_vms),
:headers => %w(Name IP\ Address VMs),
:col_options => {"name" => {:hidden => true}})
expect(controller).to receive(:get_db_view).and_return(report)
controller.send(:report_data)
view_hash = controller.send(:view_to_hash, assigns(:view))
expect(view_hash[:head]).not_to include({:text => "Name", :sort => "str", :col_idx => 0, :align => "left"})
expect(view_hash[:head]).to include({:text => "IP Address", :sort => "str", :col_idx => 1, :align => "left"})
expect(view_hash[:head]).not_to include(:text => "Name", :sort => "str", :col_idx => 0, :align => "left")
expect(view_hash[:head]).to include(:text => "IP Address", :sort => "str", :col_idx => 1, :align => "left")
end

it "renders show_list and includes all columns" do
allow(controller).to receive(:render)
report = FactoryGirl.create(:miq_report,
:name => 'Hosts',
:title => 'Hosts',
:cols => ['name', 'ipaddress', 'v_total_vms'],
:col_order => ['name', 'ipaddress', 'v_total_vms'],
:headers => ['Name', 'IP Address', 'VMs']
)
:cols => %w(name ipaddress v_total_vms),
:col_order => %w(name ipaddress v_total_vms),
:headers => %w(Name IP\ Address VMs))
expect(controller).to receive(:get_db_view).and_return(report)
controller.send(:report_data)
view_hash = controller.send(:view_to_hash, assigns(:view))
expect(view_hash[:head]).to include({:text => "Name", :sort => "str", :col_idx => 0, :align => "left"})
expect(view_hash[:head]).to include({:text => "IP Address", :sort => "str", :col_idx => 1, :align => "left"})
expect(view_hash[:head]).to include(:text => "Name", :sort => "str", :col_idx => 0, :align => "left")
expect(view_hash[:head]).to include(:text => "IP Address", :sort => "str", :col_idx => 1, :align => "left")
end

it 'edit renders GTL grid with selected Host records' do
Expand Down

0 comments on commit 815162f

Please sign in to comment.