Skip to content

Commit

Permalink
Keep consistency on allow_blank and allow_nil qualifiers
Browse files Browse the repository at this point in the history
After some discussion[1] was decided that these qualifiers do not accept
any parameter.

#722
  • Loading branch information
maurogeorge authored and mcmire committed Sep 11, 2016
1 parent e6bc6d9 commit 01e64cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions NEWS.md
@@ -1,3 +1,15 @@
# HEAD (unreleased)

### Improvements

* For consistency with other matchers, the `allow_nil` and `allow_blank`
qualifiers on the `validate_inclusion_of` matcher does not take any arguments;
using these qualifiers will always enable these options.

* *Pull request: [#747]*

[#747]: https://github.com/thoughtbot/shoulda-matchers/pull/747

# 3.1.1

### Bug fixes
Expand Down
Expand Up @@ -310,17 +310,17 @@ def in_range(range)
self
end

def allow_blank(allow_blank = true)
@options[:allow_blank] = allow_blank
def allow_blank
@options[:allow_blank] = true
self
end

def expects_to_allow_blank?
@options[:allow_blank]
end

def allow_nil(allow_nil = true)
@options[:allow_nil] = allow_nil
def allow_nil
@options[:allow_nil] = true
self
end

Expand Down

0 comments on commit 01e64cb

Please sign in to comment.