funky_form 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +19 -0
- data/funky_form.gemspec +1 -0
- data/lib/funky_form/version.rb +1 -1
- data/test/funky_form_test.rb +28 -0
- metadata +15 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 056514e20bfae06f635ac1cbc1cbb62bc801b2acd1beb4b238c5ecfd0412a0f2
|
4
|
+
data.tar.gz: 1a65919513cd99a768e64792b51de4d4d670bb8615b56e2a9fb9ccd7ee18a515
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 592eb8128ca9d493046ef5904a3ff7b5208230747ddfae5d9f5ae8c6e8a85d663f15ad8f16e5e73fd33127a14554e0d63df8788fc959f6a43e5058b79d2b487c
|
7
|
+
data.tar.gz: 67f1d8d1221b4a8869f1766c56ad6e1bcfc63a4d011de4b830afa833492518c00367618e0a86fb029652b31321845539387370a834bf485d5a88dcf8cbb4d566
|
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2013-2020 Indrek Juhkam
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the “Software”), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
+
so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/funky_form.gemspec
CHANGED
data/lib/funky_form/version.rb
CHANGED
data/test/funky_form_test.rb
CHANGED
@@ -91,6 +91,19 @@ class FunkyFormTest < MiniTest::Test
|
|
91
91
|
assert_equal "Order", form_class.model_name.to_s
|
92
92
|
end
|
93
93
|
|
94
|
+
def test_model_inheritance_with_different_model_name
|
95
|
+
base_class = new_funky_form do
|
96
|
+
model "Order"
|
97
|
+
end
|
98
|
+
|
99
|
+
form_class = Class.new(base_class) do
|
100
|
+
model "ConcreteOrder"
|
101
|
+
end
|
102
|
+
|
103
|
+
assert_equal "Order", base_class.model_name.to_s
|
104
|
+
assert_equal "ConcreteOrder", form_class.model_name.to_s
|
105
|
+
end
|
106
|
+
|
94
107
|
def test_validations
|
95
108
|
form = new_funky_form do
|
96
109
|
attribute :title, String
|
@@ -102,4 +115,19 @@ class FunkyFormTest < MiniTest::Test
|
|
102
115
|
assert !form.new(:title => "").valid?, "should be invalid when empty"
|
103
116
|
assert !form.new.valid?, "should be invalid when not specified"
|
104
117
|
end
|
118
|
+
|
119
|
+
def test_validations_with_model_inheritance
|
120
|
+
base_class = new_funky_form do
|
121
|
+
end
|
122
|
+
|
123
|
+
form = Class.new(base_class) do
|
124
|
+
model "Order"
|
125
|
+
|
126
|
+
attribute :title, String
|
127
|
+
validates :title, :presence => true
|
128
|
+
end
|
129
|
+
|
130
|
+
assert form.new(:title => "a title").valid?
|
131
|
+
assert !form.new(:title => nil).valid?, "should be invalid when nil"
|
132
|
+
end
|
105
133
|
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: funky_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Indrek Juhkam
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtus
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 3.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.2.0
|
41
41
|
description: ''
|
@@ -45,9 +45,10 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .gitignore
|
49
|
-
- .travis.yml
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
50
50
|
- Gemfile
|
51
|
+
- LICENSE
|
51
52
|
- README.rdoc
|
52
53
|
- Rakefile
|
53
54
|
- funky_form.gemspec
|
@@ -95,7 +96,8 @@ files:
|
|
95
96
|
- test/funky_form_test.rb
|
96
97
|
- test/test_helper.rb
|
97
98
|
homepage: ''
|
98
|
-
licenses:
|
99
|
+
licenses:
|
100
|
+
- MIT
|
99
101
|
metadata: {}
|
100
102
|
post_install_message:
|
101
103
|
rdoc_options: []
|
@@ -103,57 +105,17 @@ require_paths:
|
|
103
105
|
- lib
|
104
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
105
107
|
requirements:
|
106
|
-
- -
|
108
|
+
- - ">="
|
107
109
|
- !ruby/object:Gem::Version
|
108
110
|
version: '0'
|
109
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
112
|
requirements:
|
111
|
-
- -
|
113
|
+
- - ">="
|
112
114
|
- !ruby/object:Gem::Version
|
113
115
|
version: '0'
|
114
116
|
requirements: []
|
115
|
-
|
116
|
-
rubygems_version: 2.0.3
|
117
|
+
rubygems_version: 3.0.3
|
117
118
|
signing_key:
|
118
119
|
specification_version: 4
|
119
120
|
summary: Simple form objects in ruby
|
120
|
-
test_files:
|
121
|
-
- test/acceptance/posts_test.rb
|
122
|
-
- test/acceptance_test_helper.rb
|
123
|
-
- test/dummy/Rakefile
|
124
|
-
- test/dummy/app/controllers/application_controller.rb
|
125
|
-
- test/dummy/app/controllers/posts_controller.rb
|
126
|
-
- test/dummy/app/forms/post_form.rb
|
127
|
-
- test/dummy/app/helpers/application_helper.rb
|
128
|
-
- test/dummy/app/models/post.rb
|
129
|
-
- test/dummy/app/views/layouts/application.html.erb
|
130
|
-
- test/dummy/app/views/orders/new.html.erb
|
131
|
-
- test/dummy/app/views/posts/_form.html.erb
|
132
|
-
- test/dummy/app/views/posts/edit.html.erb
|
133
|
-
- test/dummy/app/views/posts/index.html.erb
|
134
|
-
- test/dummy/app/views/posts/new.html.erb
|
135
|
-
- test/dummy/config.ru
|
136
|
-
- test/dummy/config/application.rb
|
137
|
-
- test/dummy/config/boot.rb
|
138
|
-
- test/dummy/config/database.yml
|
139
|
-
- test/dummy/config/environment.rb
|
140
|
-
- test/dummy/config/environments/development.rb
|
141
|
-
- test/dummy/config/environments/production.rb
|
142
|
-
- test/dummy/config/environments/test.rb
|
143
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
144
|
-
- test/dummy/config/initializers/inflections.rb
|
145
|
-
- test/dummy/config/initializers/mime_types.rb
|
146
|
-
- test/dummy/config/initializers/secret_token.rb
|
147
|
-
- test/dummy/config/initializers/session_store.rb
|
148
|
-
- test/dummy/config/locales/en.yml
|
149
|
-
- test/dummy/config/routes.rb
|
150
|
-
- test/dummy/db/migrate/20120306162814_create_posts.rb
|
151
|
-
- test/dummy/db/schema.rb
|
152
|
-
- test/dummy/public/404.html
|
153
|
-
- test/dummy/public/422.html
|
154
|
-
- test/dummy/public/500.html
|
155
|
-
- test/dummy/public/favicon.ico
|
156
|
-
- test/dummy/public/stylesheets/.gitkeep
|
157
|
-
- test/dummy/script/rails
|
158
|
-
- test/funky_form_test.rb
|
159
|
-
- test/test_helper.rb
|
121
|
+
test_files: []
|