forked from ManageIQ/manageiq-ui-classic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ManageIQ#649 from lpichler/disable_ownership_scree…
…n_for_provider_with_tenant_mapping Disable ownership screen for provider with tenant mapping
- Loading branch information
Showing
8 changed files
with
71 additions
and
8 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,9 @@ | ||
class ApplicationHelper::Button::SetOwnership < ApplicationHelper::Button::Basic | ||
needs :@record | ||
|
||
def disabled? | ||
@error_message = _('Ownership is controlled by tenant mapping') if | ||
@record.ext_management_system.tenant_mapping_enabled? | ||
@error_message.present? | ||
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
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
25 changes: 25 additions & 0 deletions
25
spec/helpers/application_helper/buttons/set_ownership_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,25 @@ | ||
describe ApplicationHelper::Button::SetOwnership do | ||
let(:view_context) { setup_view_context_with_sandbox({}) } | ||
|
||
let(:ext_management_system) do | ||
FactoryGirl.create(:ext_management_system, :tenant_mapping_enabled => tenant_mapping_enabled) | ||
end | ||
|
||
let(:record) { FactoryGirl.create(:vm, :ext_management_system => ext_management_system) } | ||
|
||
let(:button) { described_class.new(view_context, {}, {'record' => record}, {}) } | ||
|
||
describe '#calculate_properties' do | ||
before { button.calculate_properties } | ||
|
||
context 'when provider has tenant mapping enabled' do | ||
let(:tenant_mapping_enabled) { true } | ||
it_behaves_like 'a disabled button', 'Ownership is controlled by tenant mapping' | ||
end | ||
|
||
context 'when provider has tenant mapping disabled' do | ||
let(:tenant_mapping_enabled) { false } | ||
it_behaves_like 'an enabled button' | ||
end | ||
end | ||
end |