Skip to content

Commit

Permalink
Fix and refactor tests for ::Button::BasicImage
Browse files Browse the repository at this point in the history
  • Loading branch information
Jozef Zigmund committed Nov 11, 2016
1 parent 9c5224d commit e63f2a0
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions spec/helpers/application_helper/buttons/basic_image_spec.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
describe ApplicationHelper::Button::BasicImage do
describe '#visible?' do
before do
@view_context = setup_view_context_with_sandbox({:trees => {:vandt_tree => {:active_node => "xx-arch"}},
:active_tree => :vandt_tree})
end
context "in list of archived VMs" do
before do
allow(ApplicationHelper).to receive(:get_record_cls).and_return(nil)
@sb = {:trees => {:vandt_tree => {:active_node => "xx-arch"}}}
end

it "will be skipped" do
view_context = setup_view_context_with_sandbox({})
button = described_class.new(view_context, {}, {'sb' => @sb}, {})
button = described_class.new(@view_context, {}, {}, {})
expect(button.visible?).to be_falsey
end
end

context "in list of orphaned VMs" do
before do
allow(ApplicationHelper).to receive(:get_record_cls).and_return(nil)
@sb = {:trees => {:vandt_tree => {:active_node => "xx-arch"}}}
end

it "will be skipped" do
view_context = setup_view_context_with_sandbox({})
button = described_class.new(view_context, {}, {'sb' => @sb}, {})
@view_context.x_node = "xx-orph"
button = described_class.new(@view_context, {}, {}, {})
expect(button.visible?).to be_falsey
end
end
Expand Down

0 comments on commit e63f2a0

Please sign in to comment.