Skip to content
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

GenericFeatureButton - don't catch NoMethodError #2848

Merged
merged 1 commit into from
Nov 29, 2017
Merged

GenericFeatureButton - don't catch NoMethodError #2848

merged 1 commit into from
Nov 29, 2017

Conversation

himdel
Copy link
Contributor

@himdel himdel commented Nov 28, 2017

Right now, if a @record has a supports_foo? method, but calling that method fails with a NoMethodError, GenericFeatureButton#visible? will try to fall back to AvailabilityMixin and fail on missing is_available?.

We should only fall back to is_available? if the actual supports_foo? is missing.

Thus, using respond_to? to decide which to call, and not catching any exceptions.

Cc @borod108

(gaprindashvili/no because this does have a subtle difference in behaviour and I'm not sure this won't cause any regressions..)

Right now, if a `@record` has a `supports_foo?` method, but calling that method fails with a `NoMethodError`, `GenericFeatureButton#visible?` will try to fall back to `AvailabilityMixin` and fail on missing `is_available?`.

We should only fall back to `is_available?` if the actual `supports_foo?` is missing.

Thus, using `respon_to?` to decide which to call, and not catching any exceptions.
@himdel
Copy link
Contributor Author

himdel commented Nov 28, 2017

The method should actually just say @record.supports?(@feature) but we can't do that without getting rid of AvailabilityMixin (or splitting this button in 2, but that means figuring out which should be which).

@miq-bot
Copy link
Member

miq-bot commented Nov 28, 2017

Checked commit https://github.com/himdel/manageiq-ui-classic/commit/0704f609937b826e854084826e39bfad9caddd45 with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 👍

@mzazrivec mzazrivec self-assigned this Nov 29, 2017
@mzazrivec mzazrivec added this to the Sprint 75 Ending Dec 11, 2017 milestone Nov 29, 2017
@mzazrivec mzazrivec merged commit 0097a3f into ManageIQ:master Nov 29, 2017
@himdel himdel deleted the generic-feature-butt branch November 29, 2017 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants