twilson63-sinatra-formhelpers 0.2.0 → 0.2.1
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/VERSION.yml +1 -1
- data/lib/sinatra/formhelpers.rb +2 -2
- data/sinatra-formhelpers.gemspec +1 -1
- data/test/formhelpers_test.rb +16 -1
- metadata +1 -1
data/VERSION.yml
CHANGED
data/lib/sinatra/formhelpers.rb
CHANGED
|
@@ -39,8 +39,8 @@ module Sinatra
|
|
|
39
39
|
single_tag :img, options.merge(:src => src)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
def submit(obj, value, options={})
|
|
43
|
-
single_tag :input, options.merge(:type => "submit", :value => value)
|
|
42
|
+
def submit(obj, value="", options={})
|
|
43
|
+
single_tag :input, options.merge(:type => "submit", :value => value == "" ? obj : value)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def checkbox(obj, field, options={})
|
data/sinatra-formhelpers.gemspec
CHANGED
data/test/formhelpers_test.rb
CHANGED
|
@@ -156,7 +156,22 @@ class FormHelpersTest < Test::Unit::TestCase
|
|
|
156
156
|
end
|
|
157
157
|
end
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
describe 'formhelpers submit single arg' do
|
|
160
|
+
setup do
|
|
161
|
+
mock_app {
|
|
162
|
+
helpers Sinatra::FormHelpers
|
|
163
|
+
get '/' do
|
|
164
|
+
haml "= submit 'Create'"
|
|
165
|
+
end
|
|
166
|
+
}
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
it 'renders an input tag with a submit type with single arg' do
|
|
170
|
+
get '/'
|
|
171
|
+
assert_equal "<input value='Create' type='submit' />\n", body
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
|
|
160
175
|
describe 'formhelpers checkbox' do
|
|
161
176
|
setup do
|
|
162
177
|
mock_app {
|