Remove deprecated matchers

This commit is contained in:
Elliot Winkler 2014-11-18 17:58:09 +08:00
parent ab91bbf123
commit 55c8d09bf2
7 changed files with 3 additions and 81 deletions

View File

@ -10,6 +10,9 @@
expect(record).not_to allow_value('good value', *bad_values)
* `ensure_inclusion_of`, `ensure_exclusion_of`, and `ensure_length_of` have been
removed in favor of their `validate_*` counterparts.
# 2.8.0
### Deprecations

View File

@ -89,16 +89,6 @@ module Shoulda
ValidateExclusionOfMatcher.new(attr)
end
# @deprecated Use {#validate_exclusion_of} instead.
# @return [ValidateExclusionOfMatcher]
def ensure_exclusion_of(attr)
Shoulda::Matchers.warn_about_deprecated_method(
:ensure_exclusion_of,
:validate_exclusion_of
)
validate_exclusion_of(attr)
end
# @private
class ValidateExclusionOfMatcher < ValidationMatcher
def initialize(attribute)

View File

@ -234,16 +234,6 @@ module Shoulda
ValidateInclusionOfMatcher.new(attr)
end
# @deprecated Use {#validate_inclusion_of} instead.
# @return [ValidateInclusionOfMatcher]
def ensure_inclusion_of(attr)
Shoulda::Matchers.warn_about_deprecated_method(
:ensure_inclusion_of,
:validate_inclusion_of
)
validate_inclusion_of(attr)
end
# @private
class ValidateInclusionOfMatcher < ValidationMatcher
ARBITRARY_OUTSIDE_STRING = 'shouldamatchersteststring'

View File

@ -197,16 +197,6 @@ module Shoulda
ValidateLengthOfMatcher.new(attr)
end
# @deprecated Use {#validate_length_of} instead.
# @return [ValidateLengthOfMatcher]
def ensure_length_of(attr)
Shoulda::Matchers.warn_about_deprecated_method(
:ensure_length_of,
:validate_length_of
)
validate_length_of(attr)
end
# @private
class ValidateLengthOfMatcher < ValidationMatcher
include Helpers

View File

@ -1,22 +1,5 @@
require 'unit_spec_helper'
describe Shoulda::Matchers::ActiveModel, type: :model do
describe '#ensure_exclusion_of' do
it 'is aliased to #validate_exclusion_of' do
allow(matchers).to receive(:validate_exclusion_of)
silence_warnings do
matchers.ensure_exclusion_of(:attr)
expect(matchers).to have_received(:validate_exclusion_of).with(:attr)
end
end
end
def matchers
@_matchers ||= Object.new.extend(described_class)
end
end
describe Shoulda::Matchers::ActiveModel::ValidateExclusionOfMatcher, type: :model do
context 'an attribute which must be excluded from a range' do
it 'accepts ensuring the correct range' do

View File

@ -1,22 +1,5 @@
require 'unit_spec_helper'
describe Shoulda::Matchers::ActiveModel, type: :model do
describe '#ensure_inclusion_of' do
it 'is aliased to #validate_inclusion_of' do
allow(matchers).to receive(:validate_inclusion_of)
silence_warnings do
matchers.ensure_inclusion_of(:attr)
expect(matchers).to have_received(:validate_inclusion_of)
end
end
end
def matchers
@_matchers ||= Object.new.extend(described_class)
end
end
describe Shoulda::Matchers::ActiveModel::ValidateInclusionOfMatcher, type: :model do
shared_context 'for a generic attribute' do
def self.testing_values_of_option(option_name, &block)

View File

@ -1,22 +1,5 @@
require 'unit_spec_helper'
describe Shoulda::Matchers::ActiveModel, type: :model do
describe '#ensure_length_of' do
it 'is aliased to #validate_length_of' do
allow(matchers).to receive(:validate_length_of)
silence_warnings do
matchers.ensure_length_of(:attr)
expect(matchers).to have_received(:validate_length_of).with(:attr)
end
end
end
def matchers
@_matchers ||= Object.new.extend(described_class)
end
end
describe Shoulda::Matchers::ActiveModel::ValidateLengthOfMatcher, type: :model do
context 'an attribute with a non-zero minimum length validation' do
it 'accepts ensuring the correct minimum length' do