formkeeper 0.0.10 → 0.0.11
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.
- data/lib/formkeeper/version.rb +1 -1
- data/spec/asset/euc.txt +1 -0
- data/spec/asset/utf8.txt +1 -0
- data/spec/constraint_email_spec.rb +20 -0
- data/spec/filter_utf8_spec.rb +20 -0
- metadata +11 -3
data/lib/formkeeper/version.rb
CHANGED
data/spec/asset/euc.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
�ۤ��ۤ�
|
data/spec/asset/utf8.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ほげほげ
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe FormKeeper::Constraint::Email do
|
5
|
+
|
6
|
+
it "validate value correctly" do
|
7
|
+
constraint = FormKeeper::Constraint::Email.new
|
8
|
+
constraint.validate('lyo.kato@gmail.com', true).should be_true
|
9
|
+
constraint.validate('foo.foo.foo@docomo.ne.jp', true).should be_true
|
10
|
+
constraint.validate('foo.@docomo.ne.jp', true).should be_true
|
11
|
+
constraint.validate('foo..foo@docomo.ne.jp', true).should be_true
|
12
|
+
constraint.validate('lyo.kato', true).should_not be_true
|
13
|
+
constraint.validate('foo@', true).should_not be_true
|
14
|
+
constraint.validate('@foo', true).should_not be_true
|
15
|
+
constraint.validate('.foo@example.com', true).should_not be_true
|
16
|
+
constraint.validate('foo[@example.com', true).should_not be_true
|
17
|
+
constraint.validate('foo @example.com', true).should_not be_true
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe FormKeeper::Filter::ToUTF8 do
|
5
|
+
|
6
|
+
it "handles utf-8 value correctly" do
|
7
|
+
|
8
|
+
value = File.open(File.dirname(__FILE__) + '/asset/utf8.txt') { |f| f.read.chomp }
|
9
|
+
filter = FormKeeper::Filter::ToUTF8.new('UTF-8')
|
10
|
+
filter.process(value).should == "ほげほげ";
|
11
|
+
end
|
12
|
+
|
13
|
+
it "handles euc-jp value correctly" do
|
14
|
+
|
15
|
+
value = File.open(File.dirname(__FILE__) + '/asset/euc.txt') { |f| f.read.chomp }
|
16
|
+
filter = FormKeeper::Filter::ToUTF8.new('EUC-JP')
|
17
|
+
filter.process(value).should == "ほげほげ"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formkeeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,7 +27,9 @@ files:
|
|
27
27
|
- formkeeper.gemspec
|
28
28
|
- lib/formkeeper.rb
|
29
29
|
- lib/formkeeper/version.rb
|
30
|
+
- spec/asset/euc.txt
|
30
31
|
- spec/asset/messages.yaml
|
32
|
+
- spec/asset/utf8.txt
|
31
33
|
- spec/combination_any_spec.rb
|
32
34
|
- spec/combination_date_spec.rb
|
33
35
|
- spec/combination_datetime_spec.rb
|
@@ -40,6 +42,7 @@ files:
|
|
40
42
|
- spec/constraint_ascii_space_spec.rb
|
41
43
|
- spec/constraint_ascii_spec.rb
|
42
44
|
- spec/constraint_bytesize_spec.rb
|
45
|
+
- spec/constraint_email_spec.rb
|
43
46
|
- spec/constraint_int_spec.rb
|
44
47
|
- spec/constraint_length_spec.rb
|
45
48
|
- spec/constraint_regexp_spec.rb
|
@@ -49,6 +52,7 @@ files:
|
|
49
52
|
- spec/filter_downcase_spec.rb
|
50
53
|
- spec/filter_strip_spec.rb
|
51
54
|
- spec/filter_upcase_spec.rb
|
55
|
+
- spec/filter_utf8_spec.rb
|
52
56
|
- spec/messages_spec.rb
|
53
57
|
- spec/record_spec.rb
|
54
58
|
- spec/report_spec.rb
|
@@ -70,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
74
|
version: '0'
|
71
75
|
segments:
|
72
76
|
- 0
|
73
|
-
hash:
|
77
|
+
hash: -2542690134374013236
|
74
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
79
|
none: false
|
76
80
|
requirements:
|
@@ -79,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
83
|
version: '0'
|
80
84
|
segments:
|
81
85
|
- 0
|
82
|
-
hash:
|
86
|
+
hash: -2542690134374013236
|
83
87
|
requirements: []
|
84
88
|
rubyforge_project:
|
85
89
|
rubygems_version: 1.8.24
|
@@ -87,7 +91,9 @@ signing_key:
|
|
87
91
|
specification_version: 3
|
88
92
|
summary: This modules provides you an easy way for form-validation and fill-in-form
|
89
93
|
test_files:
|
94
|
+
- spec/asset/euc.txt
|
90
95
|
- spec/asset/messages.yaml
|
96
|
+
- spec/asset/utf8.txt
|
91
97
|
- spec/combination_any_spec.rb
|
92
98
|
- spec/combination_date_spec.rb
|
93
99
|
- spec/combination_datetime_spec.rb
|
@@ -100,6 +106,7 @@ test_files:
|
|
100
106
|
- spec/constraint_ascii_space_spec.rb
|
101
107
|
- spec/constraint_ascii_spec.rb
|
102
108
|
- spec/constraint_bytesize_spec.rb
|
109
|
+
- spec/constraint_email_spec.rb
|
103
110
|
- spec/constraint_int_spec.rb
|
104
111
|
- spec/constraint_length_spec.rb
|
105
112
|
- spec/constraint_regexp_spec.rb
|
@@ -109,6 +116,7 @@ test_files:
|
|
109
116
|
- spec/filter_downcase_spec.rb
|
110
117
|
- spec/filter_strip_spec.rb
|
111
118
|
- spec/filter_upcase_spec.rb
|
119
|
+
- spec/filter_utf8_spec.rb
|
112
120
|
- spec/messages_spec.rb
|
113
121
|
- spec/record_spec.rb
|
114
122
|
- spec/report_spec.rb
|