Skip to content

Commit

Permalink
Create the allow_values matcher
Browse files Browse the repository at this point in the history
It is a alias to the actual allow_value matcher.
  • Loading branch information
maurogeorge authored and mcmire committed Apr 20, 2015
1 parent 7c8e3f5 commit ae77c7d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@

* Add `join_table` qualifier to `have_and_belong_to_many`. ([#556])

* `allow_values` is now an alias for `allow_value`. This makes more sense when
checking against multiple values:

it { should allow_values('this', 'and', 'that') }

([#692])

[#402]: https://github.com/thoughtbot/shoulda-matchers/pull/402
[#587]: https://github.com/thoughtbot/shoulda-matchers/pull/587
[#662]: https://github.com/thoughtbot/shoulda-matchers/pull/662
Expand All @@ -94,6 +101,7 @@
[#556]: https://github.com/thoughtbot/shoulda-matchers/pull/556
[#457]: https://github.com/thoughtbot/shoulda-matchers/pull/457
[#694]: https://github.com/thoughtbot/shoulda-matchers/pull/694
[#692]: https://github.com/thoughtbot/shoulda-matchers/pull/692

# 2.8.0

Expand Down
1 change: 1 addition & 0 deletions lib/shoulda/matchers/active_model/allow_value_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ def allow_value(*values)
AllowValueMatcher.new(*values)
end
end
alias_method :allow_values, :allow_value

# @private
class AllowValueMatcher
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
require 'unit_spec_helper'

describe Shoulda::Matchers::ActiveModel do
describe '#allow_values' do
it 'is aliased to #allow_value' do
expect(method(:allow_values)).to eq(method(:allow_value))
end
end
end

describe Shoulda::Matchers::ActiveModel::AllowValueMatcher, type: :model do
context "#description" do
it 'describes itself with multiple values' do
Expand Down

0 comments on commit ae77c7d

Please sign in to comment.