Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render correct partial for policy simulation detail page
- Loading branch information
1 parent
d8541d3
commit 2c60481
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
describe "vm/show.html.haml" do | ||
shared_examples_for "miq_before_onload JS is needed" do | ||
it "renders proper JS" do | ||
js_string = "var miq_after_onload = \"miqAsyncAjax('/vm/#{action}/#{vm.id}');\"" | ||
render | ||
expect(rendered).to include(js_string) | ||
end | ||
end | ||
|
||
let(:vm) { FactoryGirl.create(:vm, :name => 'vm', :description => 'vm description') } | ||
let(:action) { 'show' } | ||
|
||
before do | ||
assign(:record, vm) | ||
assign(:ajax_action, action) | ||
assign(:showtype, showtype) | ||
end | ||
|
||
context "when showtype is 'policies'" do | ||
let(:showtype) { 'policies' } | ||
let(:display) { 'main' } | ||
|
||
it 'should render policies view' do | ||
assign(:lastaction, 'policy_sim') | ||
stub_template "vm_common/_policies.html.haml" => "Stubbed Content" | ||
render | ||
expect(rendered).to render_template(:partial => 'vm_common/policies', :locals => {:controller => 'vm'}) | ||
end | ||
end | ||
end |