-
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
Fixed code to show Bottlenecks report download buttons. #4903
Merged
martinpovolny
merged 3 commits into
ManageIQ:master
from
h-kataria:bottlenecks_report_download_fix
Nov 13, 2018
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
28 changes: 28 additions & 0 deletions
28
spec/helpers/application_helper/buttons/utilization_download_spec.rb
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,28 @@ | ||
describe ApplicationHelper::Button::UtilizationDownload do | ||
let(:view_context) { setup_view_context_with_sandbox({}) } | ||
let(:report) { FactoryGirl.create(:miq_report, :miq_report_results => []) } | ||
let(:button) { described_class.new(view_context, {}, {'layout' => 'miq_capacity_bottlenecks'}, {}) } | ||
|
||
before do | ||
button.instance_variable_set(:@sb, :active_tab => "report", :report => report) | ||
allow(view_context).to receive(:x_active_tree).and_return(:bottlenecks_tree) | ||
end | ||
|
||
context '#disabled?' do | ||
it 'when report tab has no data available' do | ||
report.table = OpenStruct.new(:data => []) | ||
expect(button.disabled?).to be_truthy | ||
end | ||
|
||
it 'when report tab has data' do | ||
report.table = OpenStruct.new(:data => [:foo => 'bar']) | ||
expect(button.disabled?).to be_falsey | ||
end | ||
|
||
it 'when on summary tab' do | ||
button.instance_variable_set(:@sb, :active_tab => "summary", :report => report) | ||
report.table = OpenStruct.new(:data => [:foo => 'bar']) | ||
expect(button.disabled?).to be_truthy | ||
end | ||
end | ||
end |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There's a simpler way to chect that a particula toolbar is instantiated when a given action is requested.
Example from
spec/controllers/physical_switch_controller_spec.rb
:Not sure if it's applicable to your situation but generally it does not need much mocking.