diff options
| author | Vincent Prouillet | 2017-11-08 17:47:59 +0100 |
|---|---|---|
| committer | Vincent Prouillet | 2017-11-08 17:47:59 +0100 |
| commit | dcc3b0a42f74bedc6cf57feea0f441e7166aa027 (patch) | |
| tree | a62db24bd3d35349870810a2d7974ce15add8e92 /validator_derive/tests | |
| parent | 14a5b7a695de67f4bc2e38d5eeae2eea11fed743 (diff) | |
| download | validator-dcc3b0a42f74bedc6cf57feea0f441e7166aa027.tar.bz2 | |
Feature gate phone feature in validator_derive as well
Diffstat (limited to 'validator_derive/tests')
| -rw-r--r-- | validator_derive/tests/complex.rs | 11 | ||||
| -rw-r--r-- | validator_derive/tests/credit_card.rs | 4 |
2 files changed, 2 insertions, 13 deletions
diff --git a/validator_derive/tests/complex.rs b/validator_derive/tests/complex.rs index db62600..0bd74fa 100644 --- a/validator_derive/tests/complex.rs +++ b/validator_derive/tests/complex.rs @@ -33,8 +33,6 @@ fn validate_signup(data: &SignupData) -> Result<(), ValidationError> { struct SignupData { #[validate(email)] mail: String, - #[validate(phone)] - phone: String, #[validate(url)] site: String, #[validate(length(min = "1"), custom = "validate_unique_username")] @@ -49,7 +47,6 @@ struct SignupData { fn is_fine_with_many_valid_validations() { let signup = SignupData { mail: "bob@bob.com".to_string(), - phone: "+14152370800".to_string(), site: "http://hello.com".to_string(), first_name: "Bob".to_string(), age: 18, @@ -62,7 +59,6 @@ fn is_fine_with_many_valid_validations() { fn failed_validation_points_to_original_field_name() { let signup = SignupData { mail: "bob@bob.com".to_string(), - phone: "+14152370800".to_string(), site: "http://hello.com".to_string(), first_name: "".to_string(), age: 18, @@ -89,8 +85,6 @@ fn test_can_validate_option_fields_with_lifetime() { range: Option<usize>, #[validate(email)] email: Option<&'a str>, - #[validate(phone)] - phone: Option<&'a str>, #[validate(url)] url: Option<&'a str>, #[validate(contains = "@")] @@ -109,7 +103,6 @@ fn test_can_validate_option_fields_with_lifetime() { name: Some("al"), range: Some(2), email: Some("hi@gmail.com"), - phone: Some("+14152370800"), url: Some("http://google.com"), text: Some("@someone"), re: Some("hi"), @@ -134,8 +127,6 @@ fn test_can_validate_option_fields_without_lifetime() { range: Option<usize>, #[validate(email)] email: Option<String>, - #[validate(phone)] - phone: Option<String>, #[validate(url)] url: Option<String>, #[validate(contains = "@")] @@ -155,7 +146,6 @@ fn test_can_validate_option_fields_without_lifetime() { ids: Some(vec![1, 2, 3]), range: Some(2), email: Some("hi@gmail.com".to_string()), - phone: Some("+14152370800".to_string()), url: Some("http://google.com".to_string()), text: Some("@someone".to_string()), re: Some("hi".to_string()), @@ -170,7 +160,6 @@ fn test_works_with_question_mark_operator() { let signup = SignupData { mail: "invalid_email".to_string(), site: "http://hello.com".to_string(), - phone: "+14152370800".to_string(), first_name: "Bob".to_string(), age: 18, }; diff --git a/validator_derive/tests/credit_card.rs b/validator_derive/tests/credit_card.rs index 2f1d720..fcb30a1 100644 --- a/validator_derive/tests/credit_card.rs +++ b/validator_derive/tests/credit_card.rs @@ -24,7 +24,7 @@ fn can_validate_valid_card_number() { fn bad_credit_card_fails_validation() { #[derive(Debug, Validate)] struct TestStruct { - #[validate(email)] + #[validate(credit_card)] val: String, } @@ -36,7 +36,7 @@ fn bad_credit_card_fails_validation() { let errs = res.unwrap_err().inner(); assert!(errs.contains_key("val")); assert_eq!(errs["val"].len(), 1); - assert_eq!(errs["val"][0].code, "email"); + assert_eq!(errs["val"][0].code, "credit_card"); assert_eq!(errs["val"][0].params["value"], "bob"); } |
