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

Fixes #215: Parameters can be saved without a value #1610

Closed
wants to merge 1 commit into from

Conversation

orrabin
Copy link
Member

@orrabin orrabin commented Jul 23, 2014

No description provided.

@domcleal
Copy link
Contributor

Other models (host groups, hosts, domains, taxonomies) have the same use of nested attributes, should they be changed?

@orrabin
Copy link
Member Author

orrabin commented Jul 27, 2014

@domcleal it can be confusing, everything looks like it was saved and only when you look for your parameter you notice it isn't there.
I'm not sure anyone would actually try to create a parameter without a value but I can change the rest or the models or add a warning at the top of each parameter form that parameters without values will be rejected.
What do you think?

@orrabin
Copy link
Member Author

orrabin commented Jul 28, 2014

All models with parameters as nested attributes now act the same way as os.

@orrabin orrabin changed the title Fixes #6697: UI doesn't raise any error when we add OS parameter without any value Fixes #6697: Raising an error when we add parameter without any value Jul 28, 2014
@orrabin orrabin changed the title Fixes #6697: Raising an error when we add parameter without any value Fixes #215, Cancels #6697: Parameters can be saved without a value Jul 31, 2014
@domcleal
Copy link
Contributor

@orrabin looks good and tests well. Could you please fix the test failures and rebase? Thanks.

Nitpick: you can remove the "cancels #6697" from the commit message now, that's fine.

@orrabin orrabin changed the title Fixes #215, Cancels #6697: Parameters can be saved without a value Fixes #215: Parameters can be saved without a value Jul 31, 2014
@orrabin
Copy link
Member Author

orrabin commented Jul 31, 2014

@domcleal I removed the tests that weren't relevant anymore

@@ -18,18 +18,6 @@ class CommonParameterTest < ActiveSupport::TestCase
assert parameter.save
end

test "value can't be blank" do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be better to invert the logic of the test: just have it check that the value can be blank, and can be empty.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@domcleal thanks, I changed the tests

@domcleal
Copy link
Contributor

Thanks @orrabin, that's the oldest bug squashed in a long time :)

Merged as 32ced38 for Foreman 1.6.0.

@domcleal domcleal closed this Jul 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants