parsley_simple_form 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +27 -0
- data/lib/parsley_simple_form/constraints/base_constraint.rb +22 -0
- data/lib/parsley_simple_form/constraints/basics/equalto_constraint.rb +25 -0
- data/lib/parsley_simple_form/constraints/basics/notblank_constraint.rb +17 -0
- data/lib/parsley_simple_form/constraints/basics/required_constraint.rb +24 -0
- data/lib/parsley_simple_form/form_builder.rb +21 -25
- data/lib/parsley_simple_form/railtie.rb +2 -0
- data/lib/parsley_simple_form/version.rb +1 -1
- data/test/dummy/log/test.log +1398 -0
- data/test/form_builder_test.rb +22 -0
- data/test/support/user.rb +3 -0
- metadata +7 -3
- data/README.rdoc +0 -5
data/test/form_builder_test.rb
CHANGED
@@ -8,4 +8,26 @@ class FormBuilderTest < ActionView::TestCase
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
test 'required constraint' do
|
12
|
+
with_parsley_form_for @user do |f|
|
13
|
+
f.input :name, required: true
|
14
|
+
end
|
15
|
+
assert_select 'input[data-required-message]'
|
16
|
+
end
|
17
|
+
|
18
|
+
test 'equalto constraint' do
|
19
|
+
with_parsley_form_for @user do |f|
|
20
|
+
f.input :password, required: true
|
21
|
+
f.input :confirm_password, :equalto => :password
|
22
|
+
end
|
23
|
+
assert_select 'input[data-equalto="#user_password"]'
|
24
|
+
end
|
25
|
+
|
26
|
+
test 'notblank constraint' do
|
27
|
+
with_parsley_form_for @user do |f|
|
28
|
+
f.input :email, notblank: true
|
29
|
+
end
|
30
|
+
assert_select 'input[data-notblank]'
|
31
|
+
end
|
32
|
+
|
11
33
|
end
|
data/test/support/user.rb
CHANGED
@@ -70,6 +70,7 @@ class User
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def self.human_attribute_name(attribute)
|
73
|
+
attribute = attribute.to_s
|
73
74
|
case attribute
|
74
75
|
when 'name'
|
75
76
|
'Super User Name!'
|
@@ -77,6 +78,8 @@ class User
|
|
77
78
|
'User Description!'
|
78
79
|
when 'company'
|
79
80
|
'Company Human Name!'
|
81
|
+
when 'password'
|
82
|
+
'Password!'
|
80
83
|
else
|
81
84
|
attribute.humanize
|
82
85
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parsley_simple_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Moretti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -76,12 +76,16 @@ files:
|
|
76
76
|
- lib/tasks/parsley_simple_form_tasks.rake
|
77
77
|
- lib/parsley_simple_form.rb
|
78
78
|
- lib/parsley_simple_form/action_view_extensions/form_helper.rb
|
79
|
+
- lib/parsley_simple_form/constraints/base_constraint.rb
|
80
|
+
- lib/parsley_simple_form/constraints/basics/equalto_constraint.rb
|
81
|
+
- lib/parsley_simple_form/constraints/basics/notblank_constraint.rb
|
82
|
+
- lib/parsley_simple_form/constraints/basics/required_constraint.rb
|
79
83
|
- lib/parsley_simple_form/form_builder.rb
|
80
84
|
- lib/parsley_simple_form/railtie.rb
|
81
85
|
- lib/parsley_simple_form/version.rb
|
82
86
|
- MIT-LICENSE
|
83
87
|
- Rakefile
|
84
|
-
- README.
|
88
|
+
- README.md
|
85
89
|
- test/test_helper.rb
|
86
90
|
- test/parsley_simple_form_test.rb
|
87
91
|
- test/dummy/Rakefile
|