forme 2.1.0 → 2.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.
- checksums.yaml +4 -4
- data/CHANGELOG +10 -0
- data/README.rdoc +3 -3
- data/lib/forme/bs3.rb +7 -7
- data/lib/forme/form.rb +2 -0
- data/lib/forme/transformers/error_handler.rb +10 -10
- data/lib/forme/transformers/formatter.rb +32 -34
- data/lib/forme/version.rb +1 -1
- data/lib/sequel/plugins/forme.rb +8 -6
- data/lib/sequel/plugins/forme_set.rb +2 -4
- data/spec/bs3_reference_spec.rb +288 -311
- data/spec/bs3_sequel_plugin_spec.rb +152 -152
- data/spec/bs3_spec.rb +234 -205
- data/spec/forme_coverage.rb +1 -0
- data/spec/forme_spec.rb +429 -353
- data/spec/rails_integration_spec.rb +13 -1
- data/spec/roda_integration_spec.rb +20 -2
- data/spec/sequel_helper.rb +3 -1
- data/spec/sequel_i18n_plugin_spec.rb +4 -4
- data/spec/sequel_plugin_spec.rb +252 -149
- data/spec/sequel_set_plugin_spec.rb +6 -0
- data/spec/shared_erb_specs.rb +1 -1
- data/spec/sinatra_integration_spec.rb +26 -0
- metadata +2 -2
@@ -170,6 +170,12 @@ describe "Sequel forme_set plugin" do
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
173
|
+
it "#forme_set should not add validations for inputs with no options" do
|
174
|
+
@f.input(:artist, :options=>nil)
|
175
|
+
@ab.forme_set('artist_id'=>'1')
|
176
|
+
@ab.valid?.must_equal true
|
177
|
+
end
|
178
|
+
|
173
179
|
it "#forme_set should not require associated values for many_to_one association with select boxes" do
|
174
180
|
@f.input(:artist)
|
175
181
|
@ab.forme_set({})
|
data/spec/shared_erb_specs.rb
CHANGED
@@ -42,7 +42,7 @@ module FormeErbSpecs
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it "#form should correctly handle subform with :grid option without block" do
|
45
|
-
sin_get('/grid-noblock-multiple').sub(/ 3\z/, '3').sub(%r{<input name="_csrf" type="hidden" value="([^"]+)"/>}, '<input name="_csrf" type="hidden" value="csrf"/>').must_equal '0 <form action="/baz" class="forme artist" method="post"><input name="_csrf" type="hidden" value="csrf"/> 1 <input id="artist_albums_attributes_0_id" name="artist[albums_attributes][0][id]" type="hidden" value="1"/><table><caption>Foo</caption><thead><tr><th>Name</th><th>Copies</th></tr></thead><tbody><tr><td class="string"><input id="artist_albums_attributes_0_name" maxlength="255" name="artist[albums_attributes][0][name]" type="text" value="N"/></td><td class="integer"><input id="artist_albums_attributes_0_copies_sold" name="artist[albums_attributes][0][copies_sold]" type="
|
45
|
+
sin_get('/grid-noblock-multiple').sub(/ 3\z/, '3').sub(%r{<input name="_csrf" type="hidden" value="([^"]+)"/>}, '<input name="_csrf" type="hidden" value="csrf"/>').must_equal '0 <form action="/baz" class="forme artist" method="post"><input name="_csrf" type="hidden" value="csrf"/> 1 <input id="artist_albums_attributes_0_id" name="artist[albums_attributes][0][id]" type="hidden" value="1"/><table><caption>Foo</caption><thead><tr><th>Name</th><th>Copies</th></tr></thead><tbody><tr><td class="string"><input id="artist_albums_attributes_0_name" maxlength="255" name="artist[albums_attributes][0][name]" type="text" value="N"/></td><td class="integer"><input id="artist_albums_attributes_0_copies_sold" inputmode="numeric" name="artist[albums_attributes][0][copies_sold]" pattern="-?[0-9]*" type="text" value="2"/></td></tr></tbody></table> 2 <input type="submit" value="Sub"/></form>3'
|
46
46
|
end
|
47
47
|
|
48
48
|
it "#form should accept two hashes instead of requiring obj as first argument" do
|
@@ -31,6 +31,24 @@ class FormeSinatraTest < Sinatra::Base
|
|
31
31
|
end
|
32
32
|
|
33
33
|
instance_exec(self, &ERB_BLOCK)
|
34
|
+
|
35
|
+
get 'no-session' do
|
36
|
+
session = env.delete('rack.session')
|
37
|
+
body = erb <<END
|
38
|
+
<% form(:method=>'POST') do %>
|
39
|
+
<% end %>
|
40
|
+
END
|
41
|
+
env['rack.session'] = session
|
42
|
+
body
|
43
|
+
end
|
44
|
+
|
45
|
+
get 'no-out_buf' do
|
46
|
+
erb(<<END, :outvar=>'@_foo')
|
47
|
+
<% form(:method=>'POST') do |f| %>
|
48
|
+
<%= f.input(:text) %>
|
49
|
+
<% end %>
|
50
|
+
END
|
51
|
+
end
|
34
52
|
end
|
35
53
|
|
36
54
|
describe "Forme Sinatra ERB integration" do
|
@@ -41,5 +59,13 @@ describe "Forme Sinatra ERB integration" do
|
|
41
59
|
end
|
42
60
|
|
43
61
|
include FormeErbSpecs
|
62
|
+
|
63
|
+
it "should handle missing rack.session when using Rack::Csrf" do
|
64
|
+
sin_get('/no-session').must_equal '<form method="POST"></form>'
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should handle non-standard outvar, but without emitting into template" do
|
68
|
+
sin_get('/no-out_buf').must_equal '<input type="text"/>'
|
69
|
+
end
|
44
70
|
end
|
45
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|