reform 0.1.2 → 0.2.0
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/.gitignore +1 -0
- data/.travis.yml +0 -1
- data/CHANGES.md +13 -0
- data/Gemfile +0 -2
- data/README.md +276 -94
- data/Rakefile +6 -0
- data/TODO.md +10 -1
- data/database.sqlite3 +0 -0
- data/lib/reform/active_record.rb +2 -0
- data/lib/reform/composition.rb +55 -0
- data/lib/reform/form/active_model.rb +60 -15
- data/lib/reform/form/active_record.rb +3 -3
- data/lib/reform/form/composition.rb +69 -0
- data/lib/reform/form.rb +183 -80
- data/lib/reform/rails.rb +8 -1
- data/lib/reform/representer.rb +38 -0
- data/lib/reform/version.rb +1 -1
- data/lib/reform.rb +5 -2
- data/reform.gemspec +3 -2
- data/test/active_model_test.rb +83 -9
- data/test/coercion_test.rb +26 -0
- data/test/composition_test.rb +57 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/controllers/albums_controller.rb +18 -0
- data/test/dummy/app/controllers/application_controller.rb +4 -0
- data/test/dummy/app/controllers/musician_controller.rb +5 -0
- data/test/dummy/app/forms/album_form.rb +18 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/album.rb +4 -0
- data/test/dummy/app/models/song.rb +3 -0
- data/test/dummy/app/views/albums/new.html.erb +28 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +20 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +22 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +16 -0
- data/test/dummy/config/environments/production.rb +46 -0
- data/test/dummy/config/environments/test.rb +33 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/production.log +0 -0
- data/test/dummy/log/server.log +0 -0
- data/test/errors_test.rb +95 -0
- data/test/form_composition_test.rb +60 -0
- data/test/nested_form_test.rb +129 -0
- data/test/rails/integration_test.rb +54 -0
- data/test/reform_test.rb +80 -114
- data/test/test_helper.rb +14 -1
- metadata +86 -11
- data/lib/reform/form/dsl.rb +0 -38
- data/test/dsl_test.rb +0 -43
@@ -0,0 +1,129 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class NestedFormTest < MiniTest::Spec
|
4
|
+
class AlbumForm < Reform::Form
|
5
|
+
property :title
|
6
|
+
|
7
|
+
# class SongForm < Reform::Form
|
8
|
+
# property :title
|
9
|
+
# validates :title, :presence => true
|
10
|
+
# end
|
11
|
+
|
12
|
+
#form :hit, :class => SongForm
|
13
|
+
property :hit do
|
14
|
+
property :title
|
15
|
+
validates :title, :presence => true
|
16
|
+
end
|
17
|
+
|
18
|
+
collection :songs do
|
19
|
+
property :title
|
20
|
+
validates :title, :presence => true
|
21
|
+
end
|
22
|
+
|
23
|
+
validates :title, :presence => true
|
24
|
+
end
|
25
|
+
|
26
|
+
# AlbumForm::collection :songs, :form => SongForm
|
27
|
+
# should be: AlbumForm.new(songs: [Song, Song])
|
28
|
+
|
29
|
+
let (:album) do
|
30
|
+
OpenStruct.new(
|
31
|
+
:title => "Blackhawks Over Los Angeles",
|
32
|
+
:hit => song,
|
33
|
+
:songs => songs # TODO: document this requirement
|
34
|
+
)
|
35
|
+
end
|
36
|
+
let (:song) { OpenStruct.new(:title => "Downtown") }
|
37
|
+
let (:songs) { [OpenStruct.new(:title => "Calling")] }
|
38
|
+
let (:form) { AlbumForm.new(album) }
|
39
|
+
|
40
|
+
it "responds to #to_hash" do
|
41
|
+
form.to_hash.must_equal({"hit"=>{"title"=>"Downtown"}, "title" => "Blackhawks Over Los Angeles", "songs"=>[{"title"=>"Calling"}]})
|
42
|
+
end
|
43
|
+
|
44
|
+
it "creates nested forms" do
|
45
|
+
form.hit.must_be_kind_of Reform::Form
|
46
|
+
form.songs.must_be_kind_of Reform::Form::Forms
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "rendering" do
|
50
|
+
it { form.title.must_equal "Blackhawks Over Los Angeles" }
|
51
|
+
it { form.hit.title.must_equal "Downtown" }
|
52
|
+
it { form.songs[0].title.must_equal "Calling" }
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "#save" do
|
56
|
+
before { @result = form.validate(
|
57
|
+
"hit" =>{"title" => "Sacrifice"},
|
58
|
+
"title" =>"Second Heat",
|
59
|
+
"songs" => [{"title" => "Scarified"}])
|
60
|
+
} # TODO: test empty/non-present songs
|
61
|
+
|
62
|
+
it "updates internal Fields" do
|
63
|
+
data = {}
|
64
|
+
|
65
|
+
form.save do |f, nested_hash|
|
66
|
+
data[:title] = f.title
|
67
|
+
data[:hit_title] = f.hit.title
|
68
|
+
data[:first_title] = f.songs.first.title
|
69
|
+
end
|
70
|
+
|
71
|
+
data.must_equal(:title=>"Second Heat", :hit_title => "Sacrifice", :first_title => "Scarified")
|
72
|
+
end
|
73
|
+
|
74
|
+
it "passes form instances in first argument" do
|
75
|
+
frm = nil
|
76
|
+
|
77
|
+
form.save { |f, hsh| frm = f }
|
78
|
+
|
79
|
+
frm.must_equal form
|
80
|
+
frm.title.must_be_kind_of String
|
81
|
+
frm.hit.must_be_kind_of Reform::Form
|
82
|
+
frm.songs.first.must_be_kind_of Reform::Form
|
83
|
+
end
|
84
|
+
|
85
|
+
it "returns nested hash with symbol keys" do
|
86
|
+
nested = nil
|
87
|
+
|
88
|
+
form.save do |hash, nested_hash|
|
89
|
+
nested = nested_hash
|
90
|
+
end
|
91
|
+
|
92
|
+
nested.must_equal(:title=>"Second Heat", :hit=>{"title"=>"Sacrifice"}, :songs=>[{"title"=>"Scarified"}])
|
93
|
+
end
|
94
|
+
|
95
|
+
it "pushes data to models" do
|
96
|
+
form.save
|
97
|
+
|
98
|
+
album.title.must_equal "Second Heat"
|
99
|
+
song.title.must_equal "Sacrifice"
|
100
|
+
songs.first.title.must_equal "Scarified"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# describe "with aliased nested form name" do
|
105
|
+
# let (:form) do
|
106
|
+
# Class.new(Reform::Form) do
|
107
|
+
# form :hit, :class => AlbumForm::SongForm, :as => :song
|
108
|
+
# end.new(OpenStruct.new(:hit => OpenStruct.new(:title => "")))
|
109
|
+
# end
|
110
|
+
|
111
|
+
# it "uses alias in errors" do
|
112
|
+
# form.validate({})
|
113
|
+
# form.errors.messages.must_equal({})
|
114
|
+
# end
|
115
|
+
# end
|
116
|
+
|
117
|
+
class UnitTest < self
|
118
|
+
it "keeps Forms for form collection" do
|
119
|
+
form.send(:fields).songs.must_be_kind_of Reform::Form::Forms
|
120
|
+
end
|
121
|
+
|
122
|
+
describe "#validate" do
|
123
|
+
it "keeps Form instances" do
|
124
|
+
form.validate("songs"=>[{"title" => "Atwa"}])
|
125
|
+
form.songs.first.must_be_kind_of Reform::Form
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative "../test_helper"
|
2
|
+
|
3
|
+
require "dummy/config/environment"
|
4
|
+
require "rails/test_help" # adds stuff like @routes, etc.
|
5
|
+
|
6
|
+
# require "haml"
|
7
|
+
# require "haml/template" # Thanks, Nathan!
|
8
|
+
|
9
|
+
#ActiveRecord::Schema.define do
|
10
|
+
# create_table :artists do |table|
|
11
|
+
# table.column :name, :string
|
12
|
+
# table.timestamps
|
13
|
+
# end
|
14
|
+
|
15
|
+
# create_table :songs do |table|
|
16
|
+
# table.column :title, :string
|
17
|
+
# table.column :album_id, :integer
|
18
|
+
# end
|
19
|
+
|
20
|
+
# create_table :albums do |table|
|
21
|
+
# table.column :title, :string
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
|
25
|
+
class HasOneAndHasManyTest < ActionController::TestCase
|
26
|
+
tests AlbumsController
|
27
|
+
|
28
|
+
test "rendering 1-1 and 1-n" do
|
29
|
+
get :new
|
30
|
+
#puts @response.body
|
31
|
+
|
32
|
+
assert_select "form"
|
33
|
+
|
34
|
+
assert_select "form input" do |els|
|
35
|
+
assert_select "[name=?]", "album[title]"
|
36
|
+
assert_select "[name=?]", "album[songs_attributes][1][title]"
|
37
|
+
assert_select "[name=?]", "album[songs_attributes][0][title]"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
test "submitting invalid form" do
|
42
|
+
params = {
|
43
|
+
"album"=>{"title"=>"Rio",
|
44
|
+
"songs_attributes"=>{
|
45
|
+
"0"=>{"name"=>""},
|
46
|
+
"1"=>{"name"=>""}
|
47
|
+
}}, "commit"=>"Create Album"}
|
48
|
+
|
49
|
+
post :create, params
|
50
|
+
|
51
|
+
assert_select "form"
|
52
|
+
assert_select "li", "Songs title can't be blank"
|
53
|
+
end
|
54
|
+
end
|
data/test/reform_test.rb
CHANGED
@@ -1,31 +1,16 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
require 'active_record'
|
4
|
-
class Artist < ActiveRecord::Base
|
5
|
-
end
|
6
|
-
ActiveRecord::Base.establish_connection(
|
7
|
-
:adapter => "sqlite3",
|
8
|
-
:database => "#{Dir.pwd}/database.sqlite3"
|
9
|
-
)
|
10
|
-
|
11
|
-
|
12
3
|
class RepresenterTest < MiniTest::Spec
|
13
4
|
class SongRepresenter < Reform::Representer
|
14
|
-
|
5
|
+
property :title
|
6
|
+
property :name
|
15
7
|
end
|
16
8
|
|
17
|
-
let (:rpr) { SongRepresenter.new(
|
18
|
-
|
19
|
-
# TODO: introduce representer_for helper.
|
20
|
-
describe "::properties" do
|
21
|
-
it "accepts array of property names" do
|
22
|
-
rpr.to_hash.must_equal({"title"=>"Disconnect, Disconnect", "year" => 1990} )
|
23
|
-
end
|
24
|
-
end
|
9
|
+
let (:rpr) { SongRepresenter.new(Object.new) }
|
25
10
|
|
26
11
|
describe "#fields" do
|
27
12
|
it "returns all properties as strings" do
|
28
|
-
rpr.fields.must_equal(["title", "
|
13
|
+
rpr.fields.must_equal(["title", "name"])
|
29
14
|
end
|
30
15
|
end
|
31
16
|
end
|
@@ -53,81 +38,29 @@ class FieldsTest < MiniTest::Spec
|
|
53
38
|
end
|
54
39
|
end
|
55
40
|
|
56
|
-
class ReformTest <
|
57
|
-
|
58
|
-
errors = form.errors
|
59
|
-
errors = errors.messages unless ::ActiveModel::VERSION::MAJOR == 3 and ::ActiveModel::VERSION::MINOR == 0
|
60
|
-
errors
|
61
|
-
end
|
41
|
+
class ReformTest < ReformSpec
|
42
|
+
let (:comp) { OpenStruct.new(:name => "Duran Duran", :title => "Rio") }
|
62
43
|
|
63
|
-
let (:
|
64
|
-
let (:rio) { OpenStruct.new(:title => "Rio") }
|
44
|
+
let (:form) { SongForm.new(comp) }
|
65
45
|
|
66
|
-
let (:form) { SongForm.new(SongAndArtistMap, comp) }
|
67
46
|
|
68
|
-
|
69
|
-
|
70
|
-
|
47
|
+
describe "::properties" do
|
48
|
+
it do
|
49
|
+
Class.new(Reform::Form) do
|
50
|
+
properties [:name, :title]
|
51
|
+
end.new(comp).to_hash.must_equal({"name"=>"Duran Duran", "title"=>"Rio"})
|
52
|
+
end
|
71
53
|
end
|
72
54
|
|
73
55
|
class SongForm < Reform::Form
|
74
|
-
|
75
|
-
|
76
|
-
describe "Composition" do
|
77
|
-
class SongAndArtist < Reform::Composition
|
78
|
-
map({:artist => [:name], :song => [:title]}) #SongAndArtistMap.representable_attrs
|
79
|
-
end
|
80
|
-
|
81
|
-
let (:comp) { SongAndArtist.new(:artist => @artist=OpenStruct.new, :song => rio) }
|
82
|
-
|
83
|
-
it "delegates to models as defined" do
|
84
|
-
comp.name.must_equal nil
|
85
|
-
comp.title.must_equal "Rio"
|
86
|
-
end
|
87
|
-
|
88
|
-
it "raises when non-mapped property" do
|
89
|
-
assert_raises NoMethodError do
|
90
|
-
comp.raise_an_exception
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
it "creates readers to models" do
|
95
|
-
comp.song.object_id.must_equal rio.object_id
|
96
|
-
comp.artist.object_id.must_equal @artist.object_id
|
97
|
-
end
|
98
|
-
|
99
|
-
describe "::map_from" do
|
100
|
-
it "creates the same mapping" do
|
101
|
-
comp =
|
102
|
-
Class.new(Reform::Composition) do
|
103
|
-
map_from SongAndArtistMap
|
104
|
-
end.
|
105
|
-
new(:artist => duran, :song => rio)
|
56
|
+
property :name
|
57
|
+
property :title
|
106
58
|
|
107
|
-
|
108
|
-
comp.title.must_equal "Rio"
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe "#nested_hash_for" do
|
113
|
-
it "returns nested hash" do
|
114
|
-
comp.nested_hash_for(:name => "Jimi Hendrix", :title => "Fire").must_equal({:artist=>{:name=>"Jimi Hendrix"}, :song=>{:title=>"Fire"}})
|
115
|
-
end
|
116
|
-
|
117
|
-
it "works with strings" do
|
118
|
-
comp.nested_hash_for("name" => "Jimi Hendrix", "title" => "Fire").must_equal({:artist=>{:name=>"Jimi Hendrix"}, :song=>{:title=>"Fire"}})
|
119
|
-
end
|
120
|
-
|
121
|
-
it "works with strings in map" do
|
122
|
-
Class.new(Reform::Composition) do
|
123
|
-
map(:artist => ["name"])
|
124
|
-
end.new([nil]).nested_hash_for(:name => "Jimi Hendrix").must_equal({:artist=>{:name=>"Jimi Hendrix"}})
|
125
|
-
end
|
126
|
-
end
|
59
|
+
validates :name, :presence => true
|
127
60
|
end
|
128
61
|
|
129
62
|
describe "(new) form with empty models" do
|
130
|
-
let (:comp) {
|
63
|
+
let (:comp) { OpenStruct.new }
|
131
64
|
|
132
65
|
it "returns empty fields" do
|
133
66
|
form.title.must_equal nil
|
@@ -145,8 +78,6 @@ class ReformTest < MiniTest::Spec
|
|
145
78
|
end
|
146
79
|
|
147
80
|
describe "(edit) form with existing models" do
|
148
|
-
let (:comp) { SongAndArtist.new(:artist => duran, :song => rio) }
|
149
|
-
|
150
81
|
it "returns filled-out fields" do
|
151
82
|
form.name.must_equal "Duran Duran"
|
152
83
|
form.title.must_equal "Rio"
|
@@ -154,7 +85,7 @@ class ReformTest < MiniTest::Spec
|
|
154
85
|
end
|
155
86
|
|
156
87
|
describe "#validate" do
|
157
|
-
let (:comp) {
|
88
|
+
let (:comp) { OpenStruct.new }
|
158
89
|
|
159
90
|
it "ignores unmapped fields in input" do
|
160
91
|
form.validate("name" => "Duran Duran", :genre => "80s")
|
@@ -167,13 +98,26 @@ class ReformTest < MiniTest::Spec
|
|
167
98
|
form.validate("name" => "Duran Duran").must_equal true
|
168
99
|
end
|
169
100
|
|
101
|
+
it "exposes input via property accessors" do
|
102
|
+
comp.name.must_equal nil
|
103
|
+
form.name.must_equal nil
|
104
|
+
|
105
|
+
form.validate("name" => "Duran Duran")
|
106
|
+
|
107
|
+
form.name.must_equal "Duran Duran"
|
108
|
+
comp.name.must_equal nil # don't touch model, yet.
|
109
|
+
end
|
110
|
+
|
170
111
|
# TODO: test errors. test valid.
|
171
112
|
describe "invalid input" do
|
172
113
|
class ValidatingForm < Reform::Form
|
114
|
+
property :name
|
115
|
+
property :title
|
116
|
+
|
173
117
|
validates :name, :presence => true
|
174
118
|
validates :title, :presence => true
|
175
119
|
end
|
176
|
-
let (:form) { ValidatingForm.new(
|
120
|
+
let (:form) { ValidatingForm.new(comp) }
|
177
121
|
|
178
122
|
it "returns false when invalid" do
|
179
123
|
form.validate({}).must_equal false
|
@@ -181,70 +125,87 @@ class ReformTest < MiniTest::Spec
|
|
181
125
|
|
182
126
|
it "populates errors" do
|
183
127
|
form.validate({})
|
184
|
-
|
128
|
+
form.errors.messages.must_equal({:name=>["can't be blank"], :title=>["can't be blank"]})
|
185
129
|
end
|
186
130
|
end
|
187
131
|
|
188
132
|
describe "method validations" do
|
189
133
|
it "allows accessing models" do
|
190
134
|
form = Class.new(Reform::Form) do
|
135
|
+
property :name
|
191
136
|
validate "name_correct?"
|
192
137
|
|
193
138
|
def name_correct?
|
194
|
-
errors.add :name, "Please give me a name" if model.
|
139
|
+
errors.add :name, "Please give me a name" if model.name.nil?
|
195
140
|
end
|
196
|
-
end.new(
|
141
|
+
end.new(comp)
|
197
142
|
|
198
143
|
form.validate({}).must_equal false
|
199
|
-
|
144
|
+
form.errors.messages.must_equal({:name=>["Please give me a name"]})
|
200
145
|
end
|
201
146
|
end
|
202
147
|
|
203
148
|
describe "UniquenessValidator" do
|
204
|
-
#
|
205
|
-
#
|
206
|
-
#
|
207
|
-
#
|
208
|
-
#
|
209
|
-
#
|
210
|
-
|
149
|
+
# ActiveRecord::Schema.define do
|
150
|
+
# create_table :artists do |table|
|
151
|
+
# table.column :name, :string
|
152
|
+
# table.timestamps
|
153
|
+
# end
|
154
|
+
# end
|
155
|
+
# Artist.new(:name => "Racer X").save
|
156
|
+
|
157
|
+
let (:form) do
|
158
|
+
require 'reform/active_record'
|
159
|
+
Class.new(Reform::Form) do
|
160
|
+
include Reform::Form::ActiveRecord
|
161
|
+
model :artist
|
162
|
+
|
163
|
+
property :name
|
164
|
+
property :created_at
|
165
|
+
|
166
|
+
validates_uniqueness_of :name
|
167
|
+
validates :created_at, :presence => true # have another property to test if we mix up.
|
168
|
+
end.
|
169
|
+
new(Artist.new)
|
170
|
+
end
|
211
171
|
|
212
172
|
it "allows accessing the database" do
|
213
173
|
end
|
214
174
|
|
215
175
|
it "is valid when name is unique" do
|
216
|
-
|
176
|
+
form.validate({"name" => "Paul Gilbert", "created_at" => "November 6, 1966"}).must_equal true
|
217
177
|
end
|
218
178
|
|
219
179
|
it "is invalid and shows error when taken" do
|
220
|
-
form = ActiveRecordForm.new(SongAndArtistMap, comp)
|
221
180
|
form.validate({"name" => "Racer X"}).must_equal false
|
222
|
-
|
181
|
+
form.errors.messages.must_equal({:name=>["has already been taken"], :created_at => ["can't be blank"]})
|
223
182
|
end
|
183
|
+
end
|
184
|
+
end
|
224
185
|
|
225
|
-
|
226
|
-
|
227
|
-
include Reform::Form::ActiveRecord
|
228
|
-
model :artist, :on => :artist # FIXME: i want form.artist, so move this out of ActiveModel into ModelDelegations.
|
186
|
+
describe "#errors" do
|
187
|
+
it { form.errors.must_be_kind_of Reform::Form::Errors }
|
229
188
|
|
230
|
-
|
231
|
-
|
232
|
-
|
189
|
+
it { form.errors.messages.must_equal({}) }
|
190
|
+
|
191
|
+
it do
|
192
|
+
form.validate({"name"=>""})
|
193
|
+
form.errors.messages.must_equal({:name=>["can't be blank"]})
|
233
194
|
end
|
234
195
|
end
|
235
196
|
|
236
197
|
|
237
198
|
describe "#save" do
|
238
|
-
let (:comp) {
|
239
|
-
let (:form) { SongForm.new(
|
199
|
+
let (:comp) { OpenStruct.new }
|
200
|
+
let (:form) { SongForm.new(comp) }
|
240
201
|
|
241
202
|
before { form.validate("name" => "Diesel Boy") }
|
242
203
|
|
243
204
|
it "pushes data to models" do
|
244
205
|
form.save
|
245
206
|
|
246
|
-
comp.
|
247
|
-
comp.
|
207
|
+
comp.name.must_equal "Diesel Boy"
|
208
|
+
comp.title.must_equal nil
|
248
209
|
end
|
249
210
|
|
250
211
|
describe "#save with block" do
|
@@ -266,8 +227,13 @@ class ReformTest < MiniTest::Spec
|
|
266
227
|
hash = map
|
267
228
|
end
|
268
229
|
|
269
|
-
hash.must_equal({:
|
230
|
+
hash.must_equal({:name=>"Diesel Boy"})
|
270
231
|
end
|
271
232
|
end
|
272
233
|
end
|
234
|
+
|
235
|
+
|
236
|
+
describe "#model" do
|
237
|
+
it { form.send(:model).must_equal comp }
|
238
|
+
end
|
273
239
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,2 +1,15 @@
|
|
1
1
|
require 'reform'
|
2
|
-
require 'minitest/autorun'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
|
4
|
+
class ReformSpec < MiniTest::Spec
|
5
|
+
let (:duran) { OpenStruct.new(:name => "Duran Duran") }
|
6
|
+
let (:rio) { OpenStruct.new(:title => "Rio") }
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'active_record'
|
10
|
+
class Artist < ActiveRecord::Base
|
11
|
+
end
|
12
|
+
ActiveRecord::Base.establish_connection(
|
13
|
+
:adapter => "sqlite3",
|
14
|
+
:database => "#{Dir.pwd}/database.sqlite3"
|
15
|
+
)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,24 +10,24 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-09-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: representable
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
|
-
- -
|
20
|
+
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
22
|
+
version: 1.7.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
none: false
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: 1.
|
30
|
+
version: 1.7.0
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: activemodel
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
requirements:
|
68
68
|
- - ! '>='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
70
|
+
version: 10.1.0
|
71
71
|
type: :development
|
72
72
|
prerelease: false
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -75,7 +75,7 @@ dependencies:
|
|
75
75
|
requirements:
|
76
76
|
- - ! '>='
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
78
|
+
version: 10.1.0
|
79
79
|
- !ruby/object:Gem::Dependency
|
80
80
|
name: minitest
|
81
81
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,6 +140,22 @@ dependencies:
|
|
140
140
|
- - ! '>='
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: rails
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
147
|
+
requirements:
|
148
|
+
- - ! '>='
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
type: :development
|
152
|
+
prerelease: false
|
153
|
+
version_requirements: !ruby/object:Gem::Requirement
|
154
|
+
none: false
|
155
|
+
requirements:
|
156
|
+
- - ! '>='
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
143
159
|
description: Freeing your AR models from form logic.
|
144
160
|
email:
|
145
161
|
- apotonick@gmail.com
|
@@ -159,16 +175,47 @@ files:
|
|
159
175
|
- database.sqlite3
|
160
176
|
- gemfiles/Gemfile.rails-3.0
|
161
177
|
- lib/reform.rb
|
178
|
+
- lib/reform/active_record.rb
|
179
|
+
- lib/reform/composition.rb
|
162
180
|
- lib/reform/form.rb
|
163
181
|
- lib/reform/form/active_model.rb
|
164
182
|
- lib/reform/form/active_record.rb
|
165
183
|
- lib/reform/form/coercion.rb
|
166
|
-
- lib/reform/form/
|
184
|
+
- lib/reform/form/composition.rb
|
167
185
|
- lib/reform/rails.rb
|
186
|
+
- lib/reform/representer.rb
|
168
187
|
- lib/reform/version.rb
|
169
188
|
- reform.gemspec
|
170
189
|
- test/active_model_test.rb
|
171
|
-
- test/
|
190
|
+
- test/coercion_test.rb
|
191
|
+
- test/composition_test.rb
|
192
|
+
- test/dummy/Rakefile
|
193
|
+
- test/dummy/app/controllers/albums_controller.rb
|
194
|
+
- test/dummy/app/controllers/application_controller.rb
|
195
|
+
- test/dummy/app/controllers/musician_controller.rb
|
196
|
+
- test/dummy/app/forms/album_form.rb
|
197
|
+
- test/dummy/app/helpers/application_helper.rb
|
198
|
+
- test/dummy/app/models/album.rb
|
199
|
+
- test/dummy/app/models/song.rb
|
200
|
+
- test/dummy/app/views/albums/new.html.erb
|
201
|
+
- test/dummy/app/views/layouts/application.html.erb
|
202
|
+
- test/dummy/config.ru
|
203
|
+
- test/dummy/config/application.rb
|
204
|
+
- test/dummy/config/boot.rb
|
205
|
+
- test/dummy/config/database.yml
|
206
|
+
- test/dummy/config/environment.rb
|
207
|
+
- test/dummy/config/environments/development.rb
|
208
|
+
- test/dummy/config/environments/production.rb
|
209
|
+
- test/dummy/config/environments/test.rb
|
210
|
+
- test/dummy/config/locales/en.yml
|
211
|
+
- test/dummy/config/routes.rb
|
212
|
+
- test/dummy/db/test.sqlite3
|
213
|
+
- test/dummy/log/production.log
|
214
|
+
- test/dummy/log/server.log
|
215
|
+
- test/errors_test.rb
|
216
|
+
- test/form_composition_test.rb
|
217
|
+
- test/nested_form_test.rb
|
218
|
+
- test/rails/integration_test.rb
|
172
219
|
- test/reform_test.rb
|
173
220
|
- test/test_helper.rb
|
174
221
|
homepage: ''
|
@@ -199,6 +246,34 @@ summary: Decouples your models from form by giving you form objects with validat
|
|
199
246
|
presentation, workflows and security.
|
200
247
|
test_files:
|
201
248
|
- test/active_model_test.rb
|
202
|
-
- test/
|
249
|
+
- test/coercion_test.rb
|
250
|
+
- test/composition_test.rb
|
251
|
+
- test/dummy/Rakefile
|
252
|
+
- test/dummy/app/controllers/albums_controller.rb
|
253
|
+
- test/dummy/app/controllers/application_controller.rb
|
254
|
+
- test/dummy/app/controllers/musician_controller.rb
|
255
|
+
- test/dummy/app/forms/album_form.rb
|
256
|
+
- test/dummy/app/helpers/application_helper.rb
|
257
|
+
- test/dummy/app/models/album.rb
|
258
|
+
- test/dummy/app/models/song.rb
|
259
|
+
- test/dummy/app/views/albums/new.html.erb
|
260
|
+
- test/dummy/app/views/layouts/application.html.erb
|
261
|
+
- test/dummy/config.ru
|
262
|
+
- test/dummy/config/application.rb
|
263
|
+
- test/dummy/config/boot.rb
|
264
|
+
- test/dummy/config/database.yml
|
265
|
+
- test/dummy/config/environment.rb
|
266
|
+
- test/dummy/config/environments/development.rb
|
267
|
+
- test/dummy/config/environments/production.rb
|
268
|
+
- test/dummy/config/environments/test.rb
|
269
|
+
- test/dummy/config/locales/en.yml
|
270
|
+
- test/dummy/config/routes.rb
|
271
|
+
- test/dummy/db/test.sqlite3
|
272
|
+
- test/dummy/log/production.log
|
273
|
+
- test/dummy/log/server.log
|
274
|
+
- test/errors_test.rb
|
275
|
+
- test/form_composition_test.rb
|
276
|
+
- test/nested_form_test.rb
|
277
|
+
- test/rails/integration_test.rb
|
203
278
|
- test/reform_test.rb
|
204
279
|
- test/test_helper.rb
|