kawaii_email_address 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/lib/kawaii_email_address/validator.rb +7 -2
- data/lib/kawaii_email_address/version.rb +1 -1
- data/spec/kawaii_email_address_spec.rb +20 -11
- data/spec/spec_helper.rb +2 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5728c34af560e873951b362a546fc1006af53dbd
|
4
|
+
data.tar.gz: 829aa39b94c682285eb2df7155d05113512d0136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c834ad7caf9350bc2d4bbae6dcd45b48c2327aaff89e89d84ec8e34e0d4998b1ae5d12c44d482aee539af96a299b119b19b89696268c6762d8c00e1eceb87a9
|
7
|
+
data.tar.gz: d6688cb0885a3e998323514a5414fd431fa6d3842338b9d97a9cfb100198e1f0d762482c8ebcd63bd4f3ae8e7331e509b2e1c3b9bc6fa346bdbcc74e4a14ac69
|
data/.travis.yml
CHANGED
@@ -58,8 +58,13 @@ module KawaiiEmailAddress
|
|
58
58
|
end
|
59
59
|
|
60
60
|
when DOUBLE_QUOTE # double quote delimits quoted strings
|
61
|
-
|
62
|
-
|
61
|
+
if i == 0
|
62
|
+
in_quoted_string = true
|
63
|
+
next true
|
64
|
+
elsif (i == local_part.length - 1) && in_quoted_string
|
65
|
+
in_quoted_string = false
|
66
|
+
next true
|
67
|
+
end
|
63
68
|
|
64
69
|
when PERIOD
|
65
70
|
period_restriction_violate_domain? ||
|
@@ -11,20 +11,29 @@ describe KawaiiEmailAddress::Validator do
|
|
11
11
|
|
12
12
|
subject { KawaiiEmailAddress::Validator }
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
it { should_not pass_validation_with 'a..b@example.com' }
|
19
|
-
it { should_not pass_validation_with 'a.@example.com' }
|
20
|
-
it { should_not pass_validation_with '.aaa@example.com' }
|
14
|
+
describe 'pass case' do
|
15
|
+
it { should pass_validation_with 'a@example.com' }
|
16
|
+
it { should pass_validation_with 'a.!/==@example.com' }
|
17
|
+
end
|
21
18
|
|
22
|
-
|
23
|
-
|
19
|
+
describe 'fail case' do
|
20
|
+
it { should_not pass_validation_with 'a@bc@example.com' }
|
21
|
+
it { should_not pass_validation_with 'a..b@example.com' }
|
22
|
+
it { should_not pass_validation_with 'a.@example.com' }
|
23
|
+
it { should_not pass_validation_with '.aaa@example.com' }
|
24
|
+
it { should_not pass_validation_with 'example_address' }
|
25
|
+
it { should_not pass_validation_with '@example.com' }
|
26
|
+
end
|
24
27
|
|
25
|
-
|
28
|
+
describe 'quoted-string case' do
|
29
|
+
it { should pass_validation_with '"a@a"@example.com' }
|
30
|
+
it { should pass_validation_with "'or'1'='1'--@example.com" }
|
26
31
|
|
27
|
-
|
32
|
+
it { should_not pass_validation_with 'a"b"@example.com' }
|
33
|
+
it { should_not pass_validation_with '"a"b@example.com' }
|
34
|
+
it { should_not pass_validation_with '"a"b"@example.com' }
|
35
|
+
it { should_not pass_validation_with 'abc"defghi"xyz@example.com' }
|
36
|
+
end
|
28
37
|
|
29
38
|
context 'kawaii: aka.docomo' do
|
30
39
|
it { should pass_validation_with 'mail..example@docomo.ne.jp' }
|
data/spec/spec_helper.rb
CHANGED
@@ -5,13 +5,10 @@
|
|
5
5
|
#
|
6
6
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
CodeClimate::TestReporter.start
|
11
|
-
end
|
8
|
+
require 'simplecov'
|
9
|
+
SimpleCov.start
|
12
10
|
|
13
11
|
RSpec.configure do |config|
|
14
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
15
12
|
config.run_all_when_everything_filtered = true
|
16
13
|
config.filter_run :focus
|
17
14
|
|