active_validation 2.6.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -1
- data/.gitignore +1 -1
- data/.rspec +1 -1
- data/.travis.yml +1 -1
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile +2 -2
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/active_validation.gemspec +14 -15
- data/bin/console +1 -1
- data/bin/rake +6 -6
- data/bin/setup +1 -1
- data/lib/active_validation/matchers/ensure_valid_alpha_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_alpha_numeric_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_base64_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_boolean_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_coordinate_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_credit_card_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_currency_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_cusip_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_email_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_equality_matcher_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_hex_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_imei_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_ip_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_isbn_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_isin_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_mac_address_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_name_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_password_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_phone_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_sedol_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_slug_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_ssn_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_tracking_number_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_type_format_of.rb +3 -3
- data/lib/active_validation/matchers/ensure_valid_url_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_username_format_of.rb +4 -4
- data/lib/active_validation/matchers/ensure_valid_uuid_format_of.rb +4 -4
- data/lib/active_validation/validators/alpha_numeric_validator.rb +3 -4
- data/lib/active_validation/validators/alpha_validator.rb +3 -4
- data/lib/active_validation/validators/base64_validator.rb +3 -4
- data/lib/active_validation/validators/boolean_validator.rb +4 -4
- data/lib/active_validation/validators/coordinate_validator.rb +11 -12
- data/lib/active_validation/validators/credit_card_validator.rb +31 -39
- data/lib/active_validation/validators/currency_validator.rb +3 -4
- data/lib/active_validation/validators/cusip_validator.rb +7 -9
- data/lib/active_validation/validators/email_validator.rb +5 -5
- data/lib/active_validation/validators/equality_validator.rb +9 -13
- data/lib/active_validation/validators/hex_validator.rb +3 -4
- data/lib/active_validation/validators/imei_validator.rb +6 -8
- data/lib/active_validation/validators/ip_validator.rb +3 -4
- data/lib/active_validation/validators/isbn_validator.rb +8 -8
- data/lib/active_validation/validators/isin_validator.rb +15 -13
- data/lib/active_validation/validators/mac_address_validator.rb +8 -12
- data/lib/active_validation/validators/name_validator.rb +4 -5
- data/lib/active_validation/validators/password_validator.rb +3 -4
- data/lib/active_validation/validators/phone_validator.rb +3 -4
- data/lib/active_validation/validators/sedol_validator.rb +6 -8
- data/lib/active_validation/validators/slug_validator.rb +3 -4
- data/lib/active_validation/validators/ssn_validator.rb +3 -4
- data/lib/active_validation/validators/tracking_number_validator.rb +39 -46
- data/lib/active_validation/validators/type_validator.rb +1 -1
- data/lib/active_validation/validators/url_validator.rb +6 -6
- data/lib/active_validation/validators/username_validator.rb +3 -4
- data/lib/active_validation/validators/uuid_validator.rb +3 -4
- data/lib/active_validation/version.rb +1 -1
- data/lib/active_validation.rb +60 -61
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8101533601a42b4554d36e1b2c4d6dddef6b24a
|
4
|
+
data.tar.gz: 97f8fe9ad694de008834718099d07c2eb31fa8f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb2688046d3bca2af4a968c369d421a0c84de94b70432090263d933b3a5682b10c0f533751a5280c40d9723ad6a638fe25be6d6830925d992ba1025d75147508
|
7
|
+
data.tar.gz: fb88e6eb295209133b247b76ebb459637130f03f6be33af535434e0653094bd96721571713de7b5bcd500ff18a6302a30cdfd6da9d59575a9cfe480c0c9589bc
|
data/.coveralls.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
service_name: travis-ci
|
1
|
+
service_name: travis-ci
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.travis.yml
CHANGED
data/CODE_OF_CONDUCT.md
CHANGED
@@ -10,4 +10,4 @@ Project maintainers have the right and responsibility to remove, edit, or reject
|
|
10
10
|
|
11
11
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
12
|
|
13
|
-
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/active_validation)
|
4
4
|
[](https://travis-ci.org/drexed/active_validation)
|
5
|
-
[](https://coveralls.io/github/drexed/active_validation?branch=master)
|
6
6
|
|
7
7
|
ActiveValidation is a collection of custom validators that are often required in Rails applications plus shoulda-style RSpec matchers to test the validation rules.
|
8
8
|
|
data/Rakefile
CHANGED
data/active_validation.gemspec
CHANGED
@@ -1,31 +1,30 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "active_validation/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
7
|
+
spec.name = "active_validation"
|
8
|
+
spec.version = ActiveValidation::VERSION
|
9
|
+
spec.authors = ["Juan Gomez"]
|
10
|
+
spec.email = ["j.gomez@drexed.com"]
|
11
11
|
|
12
|
-
spec.summary
|
13
|
-
spec.description
|
14
|
-
spec.homepage
|
15
|
-
spec.license
|
12
|
+
spec.summary = %q{Gem for commonly used validators.}
|
13
|
+
spec.description = %q{Validate commonly used attributes easily with ActiveValidation.}
|
14
|
+
spec.homepage = "http://drexed.github.io/active_validation"
|
15
|
+
spec.license = "MIT"
|
16
16
|
|
17
|
-
spec.files
|
18
|
-
spec.bindir
|
19
|
-
spec.executables
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_runtime_dependency "activemodel"
|
23
23
|
spec.add_runtime_dependency "activesupport"
|
24
|
-
spec.add_runtime_dependency "active_object"
|
25
24
|
|
26
25
|
spec.add_development_dependency "bundler"
|
27
26
|
spec.add_development_dependency "coveralls"
|
28
27
|
spec.add_development_dependency "rake"
|
29
28
|
spec.add_development_dependency "rspec"
|
30
29
|
spec.add_development_dependency "shoulda"
|
31
|
-
end
|
30
|
+
end
|
data/bin/console
CHANGED
data/bin/rake
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
#
|
3
3
|
# This file was generated by Bundler.
|
4
4
|
#
|
5
|
-
# The application
|
5
|
+
# The application "rake" is installed as part of a gem, and
|
6
6
|
# this file is here to facilitate running it.
|
7
7
|
#
|
8
8
|
|
9
|
-
require
|
10
|
-
ENV[
|
9
|
+
require "pathname"
|
10
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
11
11
|
Pathname.new(__FILE__).realpath)
|
12
12
|
|
13
|
-
require
|
14
|
-
require
|
13
|
+
require "rubygems"
|
14
|
+
require "bundler/setup"
|
15
15
|
|
16
|
-
load Gem.bin_path(
|
16
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/setup
CHANGED
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_alpha_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.alpha"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_alpha_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_alpha_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_alpha_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_alpha_numeric_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.alpha_numeric"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_alpha_numeric_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_alpha_numeric_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_alpha_numeric_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_base64_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.base64"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_base64_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_base64_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_base64_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_boolean_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.boolean"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_boolean_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_boolean_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_boolean_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_coordinate_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.coordinate.coordinate"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_coordinate_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_coordinate_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_coordinate_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_credit_card_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.credit_card"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_credit_card_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_credit_card_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_credit_card_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_currency_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.currency"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_currency_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_currency_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_currency_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_cusip_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.cusip"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_cusip_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_cusip_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_cusip_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_email_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.email"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_email_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_email_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_email_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -16,13 +16,13 @@ RSpec::Matchers.define :ensure_equality_of do |attribute|
|
|
16
16
|
model.valid?
|
17
17
|
|
18
18
|
if model.errors.has_key?(attribute)
|
19
|
-
model.errors[attribute].include?(I18n.t(
|
19
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.equality", attr: @to, operator: @operator))
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
failure_message do |model|
|
24
24
|
I18n.t(
|
25
|
-
|
25
|
+
"active_validation.errors.matchers.ensure_valid_equality_format_of.failure_message_for_should",
|
26
26
|
attr: attribute.inspect,
|
27
27
|
model: model.class.name,
|
28
28
|
operator: "operator"
|
@@ -31,10 +31,10 @@ RSpec::Matchers.define :ensure_equality_of do |attribute|
|
|
31
31
|
|
32
32
|
failure_message_when_negated do |model|
|
33
33
|
I18n.t(
|
34
|
-
|
34
|
+
"active_validation.errors.matchers.ensure_valid_equality_format_of.failure_message_for_should_not",
|
35
35
|
attr: attribute.inspect,
|
36
36
|
model: model.class.name,
|
37
37
|
operator: "operator"
|
38
38
|
)
|
39
39
|
end
|
40
|
-
end
|
40
|
+
end
|
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_hex_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.hex"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_hex_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_hex_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_hex_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_imei_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.imei"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_imei_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_imei_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_imei_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_ip_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.ip"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_ip_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_ip_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_ip_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_isbn_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.isbn"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_isbn_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_isbn_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_isbn_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_isin_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.isin"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_isin_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_isin_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_isin_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -4,13 +4,13 @@ RSpec::Matchers.define :ensure_valid_mac_address_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t(
|
7
|
+
model.errors[attribute].include?(I18n.t("active_validation.errors.messages.mac_address"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |model|
|
12
12
|
I18n.t(
|
13
|
-
|
13
|
+
"active_validation.errors.matchers.ensure_valid_mac_address_format_of.failure_message_for_should",
|
14
14
|
attr: attribute.inspect,
|
15
15
|
model: model.class.name
|
16
16
|
)
|
@@ -18,9 +18,9 @@ RSpec::Matchers.define :ensure_valid_mac_address_format_of do |attribute|
|
|
18
18
|
|
19
19
|
failure_message_when_negated do |model|
|
20
20
|
I18n.t(
|
21
|
-
|
21
|
+
"active_validation.errors.matchers.ensure_valid_mac_address_format_of.failure_message_for_should_not",
|
22
22
|
attr: attribute.inspect,
|
23
23
|
model: model.class.name
|
24
24
|
)
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|