client_side_validations-rails_2 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +4 -0
  3. data/HISTORY +5 -0
  4. data/README.markdown +45 -0
  5. data/Rakefile +21 -0
  6. data/client_side_validations-rails_2.gemspec +35 -0
  7. data/generators/client_side_validations/client_side_validations_generator.rb +14 -0
  8. data/lib/client_side_validations/rails_2.rb +5 -0
  9. data/lib/client_side_validations/rails_2/action_view.rb +7 -0
  10. data/lib/client_side_validations/rails_2/action_view/form_helper.rb +11 -0
  11. data/lib/client_side_validations/rails_2/action_view/form_tag_helper.rb +6 -0
  12. data/lib/client_side_validations/rails_2/active_record.rb +14 -0
  13. data/lib/client_side_validations/rails_2/active_record/active_model.rb +12 -0
  14. data/lib/client_side_validations/rails_2/active_record/active_model/validations.rb +51 -0
  15. data/lib/client_side_validations/rails_2/active_record/active_model/validations/base.rb +25 -0
  16. data/lib/client_side_validations/rails_2/active_record/active_model/validations/numericality.rb +5 -0
  17. data/lib/client_side_validations/rails_2/active_record/middleware.rb +42 -0
  18. data/lib/client_side_validations/rails_2/active_record/validations.rb +23 -0
  19. data/lib/client_side_validations/rails_2/middleware.rb +22 -0
  20. data/lib/client_side_validations/rails_2/version.rb +5 -0
  21. data/test/action_view/cases/helper.rb +155 -0
  22. data/test/action_view/cases/test_helpers.rb +516 -0
  23. data/test/action_view/cases/test_legacy_helpers.rb +140 -0
  24. data/test/action_view/models.rb +2 -0
  25. data/test/action_view/models/comment.rb +26 -0
  26. data/test/action_view/models/post.rb +31 -0
  27. data/test/active_record/cases/helper.rb +13 -0
  28. data/test/active_record/cases/test_base.rb +10 -0
  29. data/test/active_record/cases/test_middleware.rb +157 -0
  30. data/test/active_record/cases/test_validation_reflection.rb +144 -0
  31. data/test/active_record/cases/test_validations.rb +27 -0
  32. data/test/active_record/models/guid.rb +7 -0
  33. data/test/active_record/models/user.rb +11 -0
  34. data/test/base_helper.rb +10 -0
  35. data/test/middleware/cases/helper.rb +6 -0
  36. metadata +237 -0
@@ -0,0 +1,27 @@
1
+ require 'active_record/cases/test_base'
2
+
3
+ class ValidationsTest < ClientSideValidations::ActiveRecordTestBase
4
+
5
+ def new_user
6
+ user = Class.new(User)
7
+ def user.name
8
+ 'User'
9
+ end
10
+ yield(user)
11
+ user.new
12
+ end
13
+
14
+ def test_validations_to_client_side_hash
15
+ user = new_user do |p|
16
+ p.validates_presence_of :name
17
+ end
18
+ expected_hash = {
19
+ :name => {
20
+ :presence => {
21
+ :message => "can't be blank"
22
+ }
23
+ }
24
+ }
25
+ assert_equal expected_hash, user.client_side_validation_hash
26
+ end
27
+ end
@@ -0,0 +1,7 @@
1
+ guids_table = %{CREATE TABLE guids (id INTEGER PRIMARY KEY, key text);}
2
+ ActiveRecord::Base.connection.execute(guids_table)
3
+
4
+ class Guid < ActiveRecord::Base
5
+
6
+ end
7
+
@@ -0,0 +1,11 @@
1
+ users_table = %{CREATE TABLE users (id INTEGER PRIMARY KEY, age INTEGER, name TEXT, email TEXT, title VARCHAR(5), flag BOOLEAN);}
2
+ ActiveRecord::Base.connection.execute(users_table)
3
+
4
+ class User < ActiveRecord::Base; end
5
+ class IneptWizard < User; end
6
+ class Conjurer < IneptWizard; end
7
+ class Thaumaturgist < Conjurer; end
8
+ module ActiveRecordTestModule
9
+ class User2 < User; end
10
+ end
11
+
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.setup
4
+ require 'ruby-debug'
5
+ require 'test/unit'
6
+ require 'mocha'
7
+
8
+ module ClientSideValidations
9
+ module Rails2; end
10
+ end
@@ -0,0 +1,6 @@
1
+ require 'base_helper'
2
+ require 'rack/test'
3
+ require 'action_controller'
4
+ require 'active_record'
5
+ require 'client_side_validations/rails_2/middleware'
6
+
metadata ADDED
@@ -0,0 +1,237 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: client_side_validations-rails_2
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Brian Cardarella
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-06-12 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: activesupport
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 2
32
+ - 3
33
+ - 0
34
+ version: 2.3.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: client_side_validations
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - "="
44
+ - !ruby/object:Gem::Version
45
+ hash: 62196439
46
+ segments:
47
+ - 3
48
+ - 1
49
+ - 0
50
+ - beta
51
+ - 2
52
+ version: 3.1.0.beta.2
53
+ type: :runtime
54
+ version_requirements: *id002
55
+ - !ruby/object:Gem::Dependency
56
+ name: activerecord
57
+ prerelease: false
58
+ requirement: &id003 !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 2
66
+ - 3
67
+ - 0
68
+ version: 2.3.0
69
+ type: :development
70
+ version_requirements: *id003
71
+ - !ruby/object:Gem::Dependency
72
+ name: actionpack
73
+ prerelease: false
74
+ requirement: &id004 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ hash: 3
80
+ segments:
81
+ - 2
82
+ - 3
83
+ - 0
84
+ version: 2.3.0
85
+ type: :development
86
+ version_requirements: *id004
87
+ - !ruby/object:Gem::Dependency
88
+ name: sqlite3
89
+ prerelease: false
90
+ requirement: &id005 !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ hash: 3
96
+ segments:
97
+ - 0
98
+ version: "0"
99
+ type: :development
100
+ version_requirements: *id005
101
+ - !ruby/object:Gem::Dependency
102
+ name: mocha
103
+ prerelease: false
104
+ requirement: &id006 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ hash: 3
110
+ segments:
111
+ - 0
112
+ version: "0"
113
+ type: :development
114
+ version_requirements: *id006
115
+ - !ruby/object:Gem::Dependency
116
+ name: rack-test
117
+ prerelease: false
118
+ requirement: &id007 !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ hash: 3
124
+ segments:
125
+ - 0
126
+ version: "0"
127
+ type: :development
128
+ version_requirements: *id007
129
+ - !ruby/object:Gem::Dependency
130
+ name: ruby-debug
131
+ prerelease: false
132
+ requirement: &id008 !ruby/object:Gem::Requirement
133
+ none: false
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ hash: 3
138
+ segments:
139
+ - 0
140
+ version: "0"
141
+ type: :development
142
+ version_requirements: *id008
143
+ description: Client Side Validations support for Rails 2.x
144
+ email:
145
+ - bcardarella@gmail.com
146
+ executables: []
147
+
148
+ extensions: []
149
+
150
+ extra_rdoc_files: []
151
+
152
+ files:
153
+ - .gitignore
154
+ - Gemfile
155
+ - HISTORY
156
+ - README.markdown
157
+ - Rakefile
158
+ - client_side_validations-rails_2.gemspec
159
+ - generators/client_side_validations/client_side_validations_generator.rb
160
+ - lib/client_side_validations/rails_2.rb
161
+ - lib/client_side_validations/rails_2/action_view.rb
162
+ - lib/client_side_validations/rails_2/action_view/form_helper.rb
163
+ - lib/client_side_validations/rails_2/action_view/form_tag_helper.rb
164
+ - lib/client_side_validations/rails_2/active_record.rb
165
+ - lib/client_side_validations/rails_2/active_record/active_model.rb
166
+ - lib/client_side_validations/rails_2/active_record/active_model/validations.rb
167
+ - lib/client_side_validations/rails_2/active_record/active_model/validations/base.rb
168
+ - lib/client_side_validations/rails_2/active_record/active_model/validations/numericality.rb
169
+ - lib/client_side_validations/rails_2/active_record/middleware.rb
170
+ - lib/client_side_validations/rails_2/active_record/validations.rb
171
+ - lib/client_side_validations/rails_2/middleware.rb
172
+ - lib/client_side_validations/rails_2/version.rb
173
+ - test/action_view/cases/helper.rb
174
+ - test/action_view/cases/test_helpers.rb
175
+ - test/action_view/cases/test_legacy_helpers.rb
176
+ - test/action_view/models.rb
177
+ - test/action_view/models/comment.rb
178
+ - test/action_view/models/post.rb
179
+ - test/active_record/cases/helper.rb
180
+ - test/active_record/cases/test_base.rb
181
+ - test/active_record/cases/test_middleware.rb
182
+ - test/active_record/cases/test_validation_reflection.rb
183
+ - test/active_record/cases/test_validations.rb
184
+ - test/active_record/models/guid.rb
185
+ - test/active_record/models/user.rb
186
+ - test/base_helper.rb
187
+ - test/middleware/cases/helper.rb
188
+ has_rdoc: true
189
+ homepage: ""
190
+ licenses: []
191
+
192
+ post_install_message:
193
+ rdoc_options: []
194
+
195
+ require_paths:
196
+ - lib
197
+ required_ruby_version: !ruby/object:Gem::Requirement
198
+ none: false
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ hash: 3
203
+ segments:
204
+ - 0
205
+ version: "0"
206
+ required_rubygems_version: !ruby/object:Gem::Requirement
207
+ none: false
208
+ requirements:
209
+ - - ">="
210
+ - !ruby/object:Gem::Version
211
+ hash: 3
212
+ segments:
213
+ - 0
214
+ version: "0"
215
+ requirements: []
216
+
217
+ rubyforge_project:
218
+ rubygems_version: 1.5.3
219
+ signing_key:
220
+ specification_version: 3
221
+ summary: Client Side Validations support for Rails 2.x
222
+ test_files:
223
+ - test/action_view/cases/helper.rb
224
+ - test/action_view/cases/test_helpers.rb
225
+ - test/action_view/cases/test_legacy_helpers.rb
226
+ - test/action_view/models.rb
227
+ - test/action_view/models/comment.rb
228
+ - test/action_view/models/post.rb
229
+ - test/active_record/cases/helper.rb
230
+ - test/active_record/cases/test_base.rb
231
+ - test/active_record/cases/test_middleware.rb
232
+ - test/active_record/cases/test_validation_reflection.rb
233
+ - test/active_record/cases/test_validations.rb
234
+ - test/active_record/models/guid.rb
235
+ - test/active_record/models/user.rb
236
+ - test/base_helper.rb
237
+ - test/middleware/cases/helper.rb