jintastic 1.0.2

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.
Files changed (69) hide show
  1. data/.document +5 -0
  2. data/.gitignore +5 -0
  3. data/MIT-LICENSE +21 -0
  4. data/README.md +97 -0
  5. data/Rakefile +59 -0
  6. data/VERSION.yml +5 -0
  7. data/assets/app/views/jintastic/_in_place_editor.html.erb +16 -0
  8. data/assets/public/javascripts/jintastic.js +35 -0
  9. data/config/locale/en.yml +4 -0
  10. data/init.rb +3 -0
  11. data/jintastic.gemspec +111 -0
  12. data/lib/jintastic.rb +61 -0
  13. data/test/jintastic_test.rb +7 -0
  14. data/test/test_helper.rb +10 -0
  15. data/vendor/plugins/formtastic/.gitignore +5 -0
  16. data/vendor/plugins/formtastic/MIT-LICENSE +20 -0
  17. data/vendor/plugins/formtastic/README.textile +553 -0
  18. data/vendor/plugins/formtastic/RELEASE_PROCESS +11 -0
  19. data/vendor/plugins/formtastic/Rakefile +101 -0
  20. data/vendor/plugins/formtastic/VERSION.yml +4 -0
  21. data/vendor/plugins/formtastic/formtastic.gemspec +142 -0
  22. data/vendor/plugins/formtastic/generators/form/USAGE +16 -0
  23. data/vendor/plugins/formtastic/generators/form/form_generator.rb +120 -0
  24. data/vendor/plugins/formtastic/generators/form/templates/view__form.html.erb +5 -0
  25. data/vendor/plugins/formtastic/generators/form/templates/view__form.html.haml +4 -0
  26. data/vendor/plugins/formtastic/generators/formtastic/formtastic_generator.rb +24 -0
  27. data/vendor/plugins/formtastic/generators/formtastic/templates/formtastic.css +144 -0
  28. data/vendor/plugins/formtastic/generators/formtastic/templates/formtastic_changes.css +10 -0
  29. data/vendor/plugins/formtastic/generators/formtastic/templates/formtastic_config.rb +54 -0
  30. data/vendor/plugins/formtastic/generators/formtastic_stylesheets/formtastic_stylesheets_generator.rb +16 -0
  31. data/vendor/plugins/formtastic/install.rb +2 -0
  32. data/vendor/plugins/formtastic/lib/formtastic.rb +1687 -0
  33. data/vendor/plugins/formtastic/lib/formtastic/i18n.rb +32 -0
  34. data/vendor/plugins/formtastic/lib/locale/en.yml +8 -0
  35. data/vendor/plugins/formtastic/rails/init.rb +3 -0
  36. data/vendor/plugins/formtastic/spec/buttons_spec.rb +149 -0
  37. data/vendor/plugins/formtastic/spec/commit_button_spec.rb +369 -0
  38. data/vendor/plugins/formtastic/spec/custom_builder_spec.rb +62 -0
  39. data/vendor/plugins/formtastic/spec/custom_macros.rb +561 -0
  40. data/vendor/plugins/formtastic/spec/defaults_spec.rb +20 -0
  41. data/vendor/plugins/formtastic/spec/error_proc_spec.rb +27 -0
  42. data/vendor/plugins/formtastic/spec/errors_spec.rb +85 -0
  43. data/vendor/plugins/formtastic/spec/form_helper_spec.rb +126 -0
  44. data/vendor/plugins/formtastic/spec/i18n_spec.rb +131 -0
  45. data/vendor/plugins/formtastic/spec/include_blank_spec.rb +70 -0
  46. data/vendor/plugins/formtastic/spec/input_spec.rb +628 -0
  47. data/vendor/plugins/formtastic/spec/inputs/boolean_input_spec.rb +93 -0
  48. data/vendor/plugins/formtastic/spec/inputs/check_boxes_input_spec.rb +162 -0
  49. data/vendor/plugins/formtastic/spec/inputs/country_input_spec.rb +80 -0
  50. data/vendor/plugins/formtastic/spec/inputs/date_input_spec.rb +60 -0
  51. data/vendor/plugins/formtastic/spec/inputs/datetime_input_spec.rb +169 -0
  52. data/vendor/plugins/formtastic/spec/inputs/file_input_spec.rb +33 -0
  53. data/vendor/plugins/formtastic/spec/inputs/hidden_input_spec.rb +52 -0
  54. data/vendor/plugins/formtastic/spec/inputs/numeric_input_spec.rb +44 -0
  55. data/vendor/plugins/formtastic/spec/inputs/password_input_spec.rb +46 -0
  56. data/vendor/plugins/formtastic/spec/inputs/radio_input_spec.rb +149 -0
  57. data/vendor/plugins/formtastic/spec/inputs/select_input_spec.rb +459 -0
  58. data/vendor/plugins/formtastic/spec/inputs/string_input_spec.rb +47 -0
  59. data/vendor/plugins/formtastic/spec/inputs/text_input_spec.rb +33 -0
  60. data/vendor/plugins/formtastic/spec/inputs/time_input_spec.rb +44 -0
  61. data/vendor/plugins/formtastic/spec/inputs/time_zone_input_spec.rb +102 -0
  62. data/vendor/plugins/formtastic/spec/inputs_spec.rb +395 -0
  63. data/vendor/plugins/formtastic/spec/label_spec.rb +48 -0
  64. data/vendor/plugins/formtastic/spec/semantic_errors_spec.rb +98 -0
  65. data/vendor/plugins/formtastic/spec/semantic_fields_for_spec.rb +44 -0
  66. data/vendor/plugins/formtastic/spec/spec.opts +2 -0
  67. data/vendor/plugins/formtastic/spec/spec_helper.rb +218 -0
  68. data/vendor/plugins/formtastic/uninstall.rb +1 -0
  69. metadata +132 -0
@@ -0,0 +1,32 @@
1
+ module Formtastic
2
+ module I18n
3
+
4
+ DEFAULT_SCOPE = [:formtastic].freeze
5
+ DEFAULT_VALUES = {
6
+ :required => 'required',
7
+ :yes => 'Yes',
8
+ :no => 'No',
9
+ :create => 'Create {{model}}',
10
+ :update => 'Update {{model}}'
11
+ }.freeze
12
+ SCOPES = [
13
+ '{{model}}.{{action}}.{{attribute}}',
14
+ '{{model}}.{{attribute}}',
15
+ '{{attribute}}'
16
+ ]
17
+
18
+ class << self
19
+
20
+ def translate(*args)
21
+ key = args.shift.to_sym
22
+ options = args.extract_options!
23
+ options.reverse_merge!(:default => DEFAULT_VALUES[key])
24
+ options[:scope] = [DEFAULT_SCOPE, options[:scope]].flatten.compact
25
+ ::I18n.translate(key, *(args << options))
26
+ end
27
+ alias :t :translate
28
+
29
+ end
30
+
31
+ end
32
+ end
@@ -0,0 +1,8 @@
1
+ en:
2
+ formtastic:
3
+ :yes: 'Yes'
4
+ :no: 'No'
5
+ create: 'Create'
6
+ save: 'Save'
7
+ submit: 'Submit'
8
+ required: 'Required'
@@ -0,0 +1,3 @@
1
+ # coding: utf-8
2
+ require File.join(File.dirname(__FILE__), *%w[.. lib formtastic])
3
+ ActionView::Base.send :include, Formtastic::SemanticFormHelper
@@ -0,0 +1,149 @@
1
+ # coding: utf-8
2
+ require File.dirname(__FILE__) + '/spec_helper'
3
+
4
+ describe 'SemanticFormBuilder#buttons' do
5
+
6
+ include FormtasticSpecHelper
7
+
8
+ before do
9
+ @output_buffer = ''
10
+ mock_everything
11
+ end
12
+
13
+ describe 'with a block' do
14
+ describe 'when no options are provided' do
15
+ before do
16
+ semantic_form_for(@new_post) do |builder|
17
+ builder.buttons do
18
+ concat('hello')
19
+ end
20
+ end
21
+ end
22
+
23
+ it 'should render a fieldset inside the form, with a class of "inputs"' do
24
+ output_buffer.should have_tag("form fieldset.buttons")
25
+ end
26
+
27
+ it 'should render an ol inside the fieldset' do
28
+ output_buffer.should have_tag("form fieldset.buttons ol")
29
+ end
30
+
31
+ it 'should render the contents of the block inside the ol' do
32
+ output_buffer.should have_tag("form fieldset.buttons ol", /hello/)
33
+ end
34
+
35
+ it 'should not render a legend inside the fieldset' do
36
+ output_buffer.should_not have_tag("form fieldset.buttons legend")
37
+ end
38
+ end
39
+
40
+ describe 'when a :name option is provided' do
41
+ before do
42
+ @legend_text = "Advanced options"
43
+
44
+ semantic_form_for(@new_post) do |builder|
45
+ builder.buttons :name => @legend_text do
46
+ end
47
+ end
48
+ end
49
+ it 'should render a fieldset inside the form' do
50
+ output_buffer.should have_tag("form fieldset legend", /#{@legend_text}/)
51
+ end
52
+ end
53
+
54
+ describe 'when other options are provided' do
55
+ before do
56
+ @id_option = 'advanced'
57
+ @class_option = 'wide'
58
+
59
+ semantic_form_for(@new_post) do |builder|
60
+ builder.buttons :id => @id_option, :class => @class_option do
61
+ end
62
+ end
63
+ end
64
+ it 'should pass the options into the fieldset tag as attributes' do
65
+ output_buffer.should have_tag("form fieldset##{@id_option}")
66
+ output_buffer.should have_tag("form fieldset.#{@class_option}")
67
+ end
68
+ end
69
+
70
+ end
71
+
72
+ describe 'without a block' do
73
+
74
+ describe 'with no args (default buttons)' do
75
+
76
+ before do
77
+ semantic_form_for(@new_post) do |builder|
78
+ concat(builder.buttons)
79
+ end
80
+ end
81
+
82
+ it 'should render a form' do
83
+ output_buffer.should have_tag('form')
84
+ end
85
+
86
+ it 'should render a buttons fieldset inside the form' do
87
+ output_buffer.should have_tag('form fieldset.buttons')
88
+ end
89
+
90
+ it 'should not render a legend in the fieldset' do
91
+ output_buffer.should_not have_tag('form fieldset.buttons legend')
92
+ end
93
+
94
+ it 'should render an ol in the fieldset' do
95
+ output_buffer.should have_tag('form fieldset.buttons ol')
96
+ end
97
+
98
+ it 'should render a list item in the ol for each default button' do
99
+ output_buffer.should have_tag('form fieldset.buttons ol li', :count => 1)
100
+ end
101
+
102
+ it 'should render a commit list item for the commit button' do
103
+ output_buffer.should have_tag('form fieldset.buttons ol li.commit')
104
+ end
105
+
106
+ end
107
+
108
+ describe 'with button names as args' do
109
+
110
+ before do
111
+ semantic_form_for(@new_post) do |builder|
112
+ concat(builder.buttons(:commit))
113
+ end
114
+ end
115
+
116
+ it 'should render a form with a fieldset containing a list item for each button arg' do
117
+ output_buffer.should have_tag('form > fieldset.buttons > ol > li', :count => 1)
118
+ output_buffer.should have_tag('form > fieldset.buttons > ol > li.commit')
119
+ end
120
+
121
+ end
122
+
123
+ describe 'with button names as args and an options hash' do
124
+
125
+ before do
126
+ semantic_form_for(@new_post) do |builder|
127
+ concat(builder.buttons(:commit, :name => "Now click a button", :id => "my-id"))
128
+ end
129
+ end
130
+
131
+ it 'should render a form with a fieldset containing a list item for each button arg' do
132
+ output_buffer.should have_tag('form > fieldset.buttons > ol > li', :count => 1)
133
+ output_buffer.should have_tag('form > fieldset.buttons > ol > li.commit', :count => 1)
134
+ end
135
+
136
+ it 'should pass the options down to the fieldset' do
137
+ output_buffer.should have_tag('form > fieldset#my-id.buttons')
138
+ end
139
+
140
+ it 'should use the special :name option as a text for the legend tag' do
141
+ output_buffer.should have_tag('form > fieldset#my-id.buttons > legend', /Now click a button/)
142
+ end
143
+
144
+ end
145
+
146
+ end
147
+
148
+ end
149
+
@@ -0,0 +1,369 @@
1
+ # coding: utf-8
2
+ require File.dirname(__FILE__) + '/spec_helper'
3
+
4
+ describe 'SemanticFormBuilder#commit_button' do
5
+
6
+ include FormtasticSpecHelper
7
+
8
+ before do
9
+ @output_buffer = ''
10
+ mock_everything
11
+ end
12
+
13
+ describe 'when used on any record' do
14
+
15
+ before do
16
+ @new_post.stub!(:new_record?).and_return(false)
17
+ semantic_form_for(@new_post) do |builder|
18
+ concat(builder.commit_button)
19
+ end
20
+ end
21
+
22
+ it 'should render a commit li' do
23
+ output_buffer.should have_tag('li.commit')
24
+ end
25
+
26
+ it 'should render an input with a type attribute of "submit"' do
27
+ output_buffer.should have_tag('li.commit input[@type="submit"]')
28
+ end
29
+
30
+ it 'should render an input with a name attribute of "commit"' do
31
+ output_buffer.should have_tag('li.commit input[@name="commit"]')
32
+ end
33
+
34
+ it 'should pass options given in :button_html to the button' do
35
+ @new_post.stub!(:new_record?).and_return(false)
36
+ semantic_form_for(@new_post) do |builder|
37
+ concat(builder.commit_button('text', :button_html => {:class => 'my_class', :id => 'my_id'}))
38
+ end
39
+
40
+ output_buffer.should have_tag('li.commit input#my_id')
41
+ output_buffer.should have_tag('li.commit input.my_class')
42
+ end
43
+
44
+ end
45
+
46
+ describe "its accesskey" do
47
+
48
+ it 'should allow nil default' do
49
+ with_config :default_commit_button_accesskey, nil do
50
+ output_buffer.should_not have_tag('li.commit input[@accesskey]')
51
+ end
52
+ end
53
+
54
+ it 'should use the default if set' do
55
+ with_config :default_commit_button_accesskey, 's' do
56
+ @new_post.stub!(:new_record?).and_return(false)
57
+ semantic_form_for(@new_post) do |builder|
58
+ concat(builder.commit_button('text', :button_html => {}))
59
+ end
60
+ output_buffer.should have_tag('li.commit input[@accesskey="s"]')
61
+ end
62
+ end
63
+
64
+ it 'should use the value set in options over the default' do
65
+ with_config :default_commit_button_accesskey, 's' do
66
+ @new_post.stub!(:new_record?).and_return(false)
67
+ semantic_form_for(@new_post) do |builder|
68
+ concat(builder.commit_button('text', :accesskey => 'o'))
69
+ end
70
+ output_buffer.should_not have_tag('li.commit input[@accesskey="s"]')
71
+ output_buffer.should have_tag('li.commit input[@accesskey="o"]')
72
+ end
73
+ end
74
+
75
+ it 'should use the value set in button_html over options' do
76
+ with_config :default_commit_button_accesskey, 's' do
77
+ @new_post.stub!(:new_record?).and_return(false)
78
+ semantic_form_for(@new_post) do |builder|
79
+ concat(builder.commit_button('text', :accesskey => 'o', :button_html => {:accesskey => 't'}))
80
+ end
81
+ output_buffer.should_not have_tag('li.commit input[@accesskey="s"]')
82
+ output_buffer.should_not have_tag('li.commit input[@accesskey="o"]')
83
+ output_buffer.should have_tag('li.commit input[@accesskey="t"]')
84
+ end
85
+ end
86
+
87
+ end
88
+
89
+ describe 'when the first option is a string and the second is a hash' do
90
+
91
+ before do
92
+ @new_post.stub!(:new_record?).and_return(false)
93
+ semantic_form_for(@new_post) do |builder|
94
+ concat(builder.commit_button("a string", :button_html => { :class => "pretty"}))
95
+ end
96
+ end
97
+
98
+ it "should render the string as the value of the button" do
99
+ output_buffer.should have_tag('li input[@value="a string"]')
100
+ end
101
+
102
+ it "should deal with the options hash" do
103
+ output_buffer.should have_tag('li input.pretty')
104
+ end
105
+
106
+ end
107
+
108
+ describe 'when the first option is a hash' do
109
+
110
+ before do
111
+ @new_post.stub!(:new_record?).and_return(false)
112
+ semantic_form_for(@new_post) do |builder|
113
+ concat(builder.commit_button(:button_html => { :class => "pretty"}))
114
+ end
115
+ end
116
+
117
+ it "should deal with the options hash" do
118
+ output_buffer.should have_tag('li input.pretty')
119
+ end
120
+
121
+ end
122
+
123
+ describe 'label' do
124
+ before do
125
+ ::Post.stub!(:human_name).and_return('Post')
126
+ end
127
+
128
+ # No object
129
+ describe 'when used without object' do
130
+ describe 'when explicit label is provided' do
131
+ it 'should render an input with the explicitly specified label' do
132
+ semantic_form_for(:post, :url => 'http://example.com') do |builder|
133
+ concat(builder.commit_button("Click!"))
134
+ end
135
+ output_buffer.should have_tag('li.commit input[@value="Click!"][@class~="submit"]')
136
+ end
137
+ end
138
+
139
+ describe 'when no explicit label is provided' do
140
+ describe 'when no I18n-localized label is provided' do
141
+ before do
142
+ ::I18n.backend.store_translations :en, :formtastic => {:submit => 'Submit {{model}}'}
143
+ end
144
+
145
+ after do
146
+ ::I18n.backend.store_translations :en, :formtastic => {:submit => nil}
147
+ end
148
+
149
+ it 'should render an input with default I18n-localized label (fallback)' do
150
+ semantic_form_for(:post, :url => 'http://example.com') do |builder|
151
+ concat(builder.commit_button)
152
+ end
153
+ output_buffer.should have_tag('li.commit input[@value="Submit Post"][@class~="submit"]')
154
+ end
155
+ end
156
+
157
+ describe 'when I18n-localized label is provided' do
158
+ before do
159
+ ::I18n.backend.store_translations :en,
160
+ :formtastic => {
161
+ :actions => {
162
+ :submit => 'Custom Submit',
163
+ :post => {
164
+ :submit => 'Custom Submit {{model}}'
165
+ }
166
+ }
167
+ }
168
+ ::Formtastic::SemanticFormBuilder.i18n_lookups_by_default = true
169
+ end
170
+
171
+ it 'should render an input with localized label (I18n)' do
172
+ semantic_form_for(:post, :url => 'http://example.com') do |builder|
173
+ concat(builder.commit_button)
174
+ end
175
+ output_buffer.should have_tag(%Q{li.commit input[@value="Custom Submit Post"][@class~="submit"]})
176
+ end
177
+
178
+ it 'should render an input with anoptional localized label (I18n) - if first is not set' do
179
+ ::I18n.backend.store_translations :en,
180
+ :formtastic => {
181
+ :actions => {
182
+ :post => {
183
+ :submit => nil
184
+ }
185
+ }
186
+ }
187
+ semantic_form_for(:post, :url => 'http://example.com') do |builder|
188
+ concat(builder.commit_button)
189
+ end
190
+ output_buffer.should have_tag(%Q{li.commit input[@value="Custom Submit"][@class~="submit"]})
191
+ end
192
+
193
+ end
194
+ end
195
+ end
196
+
197
+ # New record
198
+ describe 'when used on a new record' do
199
+ before do
200
+ @new_post.stub!(:new_record?).and_return(true)
201
+ end
202
+
203
+ describe 'when explicit label is provided' do
204
+ it 'should render an input with the explicitly specified label' do
205
+ semantic_form_for(@new_post) do |builder|
206
+ concat(builder.commit_button("Click!"))
207
+ end
208
+ output_buffer.should have_tag('li.commit input[@value="Click!"][@class~="create"]')
209
+ end
210
+ end
211
+
212
+ describe 'when no explicit label is provided' do
213
+ describe 'when no I18n-localized label is provided' do
214
+ before do
215
+ ::I18n.backend.store_translations :en, :formtastic => {:create => 'Create {{model}}'}
216
+ end
217
+
218
+ after do
219
+ ::I18n.backend.store_translations :en, :formtastic => {:create => nil}
220
+ end
221
+
222
+ it 'should render an input with default I18n-localized label (fallback)' do
223
+ semantic_form_for(@new_post) do |builder|
224
+ concat(builder.commit_button)
225
+ end
226
+ output_buffer.should have_tag('li.commit input[@value="Create Post"][@class~="create"]')
227
+ end
228
+ end
229
+
230
+ describe 'when I18n-localized label is provided' do
231
+ before do
232
+ ::I18n.backend.store_translations :en,
233
+ :formtastic => {
234
+ :actions => {
235
+ :create => 'Custom Create',
236
+ :post => {
237
+ :create => 'Custom Create {{model}}'
238
+ }
239
+ }
240
+ }
241
+ ::Formtastic::SemanticFormBuilder.i18n_lookups_by_default = true
242
+ end
243
+
244
+ after do
245
+ ::I18n.backend.store_translations :en, :formtastic => nil
246
+ end
247
+
248
+ it 'should render an input with localized label (I18n)' do
249
+ semantic_form_for(@new_post) do |builder|
250
+ concat(builder.commit_button)
251
+ end
252
+ output_buffer.should have_tag(%Q{li.commit input[@value="Custom Create Post"][@class~="create"]})
253
+ end
254
+
255
+ it 'should render an input with anoptional localized label (I18n) - if first is not set' do
256
+ ::I18n.backend.store_translations :en,
257
+ :formtastic => {
258
+ :actions => {
259
+ :post => {
260
+ :create => nil
261
+ }
262
+ }
263
+ }
264
+ semantic_form_for(@new_post) do |builder|
265
+ concat(builder.commit_button)
266
+ end
267
+ output_buffer.should have_tag(%Q{li.commit input[@value="Custom Create"][@class~="create"]})
268
+ ::I18n.backend.store_translations :en, :formtastic => nil
269
+
270
+ end
271
+
272
+ end
273
+ end
274
+ end
275
+
276
+ # Existing record
277
+ describe 'when used on an existing record' do
278
+ before do
279
+ @new_post.stub!(:new_record?).and_return(false)
280
+ end
281
+
282
+ describe 'when explicit label is provided' do
283
+ it 'should render an input with the explicitly specified label' do
284
+ semantic_form_for(@new_post) do |builder|
285
+ concat(builder.commit_button("Click!"))
286
+ end
287
+ output_buffer.should have_tag('li.commit input[@value="Click!"][@class~="update"]')
288
+ end
289
+ end
290
+
291
+ describe 'when no explicit label is provided' do
292
+ describe 'when no I18n-localized label is provided' do
293
+ before do
294
+ ::I18n.backend.store_translations :en, :formtastic => {:update => 'Save {{model}}'}
295
+ end
296
+
297
+ after do
298
+ ::I18n.backend.store_translations :en, :formtastic => {:update => nil}
299
+ end
300
+
301
+ it 'should render an input with default I18n-localized label (fallback)' do
302
+ semantic_form_for(@new_post) do |builder|
303
+ concat(builder.commit_button)
304
+ end
305
+ output_buffer.should have_tag('li.commit input[@value="Save Post"][@class~="update"]')
306
+ end
307
+ end
308
+
309
+ describe 'when I18n-localized label is provided' do
310
+ before do
311
+ ::I18n.backend.store_translations :en,
312
+ :formtastic => {
313
+ :actions => {
314
+ :update => 'Custom Save',
315
+ :post => {
316
+ :update => 'Custom Save {{model}}'
317
+ }
318
+ }
319
+ }
320
+ ::Formtastic::SemanticFormBuilder.i18n_lookups_by_default = true
321
+ end
322
+
323
+ it 'should render an input with localized label (I18n)' do
324
+ semantic_form_for(@new_post) do |builder|
325
+ concat(builder.commit_button)
326
+ end
327
+ output_buffer.should have_tag(%Q{li.commit input[@value="Custom Save Post"][@class~="update"]})
328
+ end
329
+
330
+ it 'should render an input with anoptional localized label (I18n) - if first is not set' do
331
+ ::I18n.backend.store_translations :en,
332
+ :formtastic => {
333
+ :actions => {
334
+ :post => {
335
+ :update => nil
336
+ }
337
+ }
338
+ }
339
+ semantic_form_for(@new_post) do |builder|
340
+ concat(builder.commit_button)
341
+ end
342
+ output_buffer.should have_tag(%Q{li.commit input[@value="Custom Save"][@class~="update"]})
343
+ ::I18n.backend.store_translations :en, :formtastic => {}
344
+ end
345
+
346
+ end
347
+ end
348
+ end
349
+ end
350
+
351
+ describe 'when the model is two words' do
352
+ before do
353
+ output_buffer = ''
354
+ class ::UserPost; def id; end; end
355
+ @new_user_post = ::UserPost.new
356
+
357
+ @new_user_post.stub!(:new_record?).and_return(true)
358
+ semantic_form_for(@new_user_post, :url => '') do |builder|
359
+ concat(builder.commit_button())
360
+ end
361
+ end
362
+
363
+ it "should render the string as the value of the button" do
364
+ output_buffer.should have_tag('li input[@value="Create User post"]')
365
+ end
366
+
367
+ end
368
+
369
+ end