Skip to content

Commit

Permalink
Spec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bmclaughlin committed Apr 18, 2017
1 parent 3469910 commit f7cdbda
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spec/controllers/vm_common_spec.rb
Expand Up @@ -310,6 +310,26 @@
end
end

context '#evm_relationship_get_form_vars' do
before :each do
@vm = FactoryGirl.create(:vm_vmware)
edit = {:vm_id => @vm.id, :new => {:server => nil}}
controller.instance_variable_set(:@edit, edit)
end

it 'does not set new server when params[:server_id] is not set' do
controller.instance_variable_set(:@_params, :server_id => '')
controller.send(:evm_relationship_get_form_vars)
expect(assigns(:edit)[:new][:server]).to be(nil)
end

it 'sets new server when params[:server_id] is set' do
controller.instance_variable_set(:@_params, :server_id => '42')
controller.send(:evm_relationship_get_form_vars)
expect(assigns(:edit)[:new][:server]).to eq(controller.params[:server_id])
end
end

include_examples '#download_summary_pdf', :vm_cloud
include_examples '#download_summary_pdf', :vm_infra
end

0 comments on commit f7cdbda

Please sign in to comment.