formtastic 2.3.0.rc2 → 2.3.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.travis.yml +27 -1
  2. data/Appraisals +5 -0
  3. data/CHANGELOG +1 -0
  4. data/README.textile +19 -26
  5. data/formtastic.gemspec +4 -3
  6. data/gemfiles/rails_3.0.gemfile +1 -1
  7. data/gemfiles/rails_3.1.gemfile +1 -1
  8. data/gemfiles/rails_3.2.gemfile +1 -1
  9. data/gemfiles/rails_4.0.4.gemfile +7 -0
  10. data/gemfiles/rails_4.gemfile +1 -1
  11. data/lib/formtastic/form_builder.rb +9 -1
  12. data/lib/formtastic/helpers/form_helper.rb +11 -6
  13. data/lib/formtastic/helpers/inputs_helper.rb +6 -1
  14. data/lib/formtastic/inputs/base/collections.rb +1 -1
  15. data/lib/formtastic/inputs/base/validations.rb +1 -1
  16. data/lib/formtastic/inputs/boolean_input.rb +4 -14
  17. data/lib/formtastic/inputs/check_boxes_input.rb +7 -1
  18. data/lib/formtastic/inputs/radio_input.rb +2 -0
  19. data/lib/formtastic/util.rb +13 -1
  20. data/lib/formtastic/version.rb +1 -1
  21. data/lib/generators/templates/_form.html.slim +2 -2
  22. data/lib/generators/templates/formtastic.rb +15 -1
  23. data/spec/actions/generic_action_spec.rb +3 -3
  24. data/spec/builder/custom_builder_spec.rb +7 -7
  25. data/spec/builder/semantic_fields_for_spec.rb +8 -8
  26. data/spec/generators/formtastic/form/form_generator_spec.rb +6 -6
  27. data/spec/helpers/action_helper_spec.rb +11 -11
  28. data/spec/helpers/form_helper_spec.rb +22 -11
  29. data/spec/helpers/input_helper_spec.rb +44 -44
  30. data/spec/helpers/inputs_helper_spec.rb +64 -31
  31. data/spec/helpers/semantic_errors_helper_spec.rb +12 -12
  32. data/spec/i18n_spec.rb +5 -5
  33. data/spec/inputs/boolean_input_spec.rb +6 -5
  34. data/spec/inputs/check_boxes_input_spec.rb +27 -9
  35. data/spec/inputs/country_input_spec.rb +5 -5
  36. data/spec/inputs/custom_input_spec.rb +1 -1
  37. data/spec/inputs/date_picker_input_spec.rb +4 -4
  38. data/spec/inputs/datetime_picker_input_spec.rb +4 -4
  39. data/spec/inputs/hidden_input_spec.rb +3 -3
  40. data/spec/inputs/include_blank_spec.rb +2 -2
  41. data/spec/inputs/number_input_spec.rb +36 -36
  42. data/spec/inputs/radio_input_spec.rb +23 -5
  43. data/spec/inputs/range_input_spec.rb +19 -19
  44. data/spec/inputs/select_input_spec.rb +40 -20
  45. data/spec/inputs/string_input_spec.rb +2 -2
  46. data/spec/inputs/time_picker_input_spec.rb +4 -4
  47. data/spec/localizer_spec.rb +1 -1
  48. data/spec/spec_helper.rb +203 -188
  49. data/spec/support/custom_macros.rb +8 -8
  50. metadata +15 -13
@@ -45,7 +45,7 @@ describe 'AnyCustomInput' do
45
45
 
46
46
  describe 'with an implementation' do
47
47
  it "should raise a NotImplementedError exception" do
48
- expect { ::ImplementedInput.new(*input_args).to_html }.to_not raise_error(NotImplementedError)
48
+ expect { ::ImplementedInput.new(*input_args).to_html }.to_not raise_error
49
49
  end
50
50
  end
51
51
 
@@ -122,7 +122,7 @@ describe 'date_picker input' do
122
122
 
123
123
  before do
124
124
  @date = Date.new(2000, 11, 11)
125
- @new_post.stub!(:publish_at).and_return(@date)
125
+ @new_post.stub(:publish_at).and_return(@date)
126
126
  end
127
127
 
128
128
  it "renders the date as YYYY-MM-DD" do
@@ -149,7 +149,7 @@ describe 'date_picker input' do
149
149
 
150
150
  before do
151
151
  @time = Time.utc(2000,11,11,11,11,11)
152
- @new_post.stub!(:publish_at).and_return(@time)
152
+ @new_post.stub(:publish_at).and_return(@time)
153
153
  end
154
154
 
155
155
  it "renders the time as a YYYY-MM-DD" do
@@ -175,7 +175,7 @@ describe 'date_picker input' do
175
175
  context "when method returns an empty String" do
176
176
 
177
177
  before do
178
- @new_post.stub!(:publish_at).and_return("")
178
+ @new_post.stub(:publish_at).and_return("")
179
179
  end
180
180
 
181
181
  it "will be empty" do
@@ -201,7 +201,7 @@ describe 'date_picker input' do
201
201
  context "when method returns a String" do
202
202
 
203
203
  before do
204
- @new_post.stub!(:publish_at).and_return("yeah")
204
+ @new_post.stub(:publish_at).and_return("yeah")
205
205
  end
206
206
 
207
207
  it "will be the string" do
@@ -157,7 +157,7 @@ describe 'datetime_picker input' do
157
157
 
158
158
  before do
159
159
  @date = Date.new(2000, 11, 11)
160
- @new_post.stub!(:publish_at).and_return(@date)
160
+ @new_post.stub(:publish_at).and_return(@date)
161
161
  end
162
162
 
163
163
  it "renders the date as YYYY-MM-DDT00:00:00" do
@@ -184,7 +184,7 @@ describe 'datetime_picker input' do
184
184
 
185
185
  before do
186
186
  @time = Time.utc(2000,11,11,11,11,11)
187
- @new_post.stub!(:publish_at).and_return(@time)
187
+ @new_post.stub(:publish_at).and_return(@time)
188
188
  end
189
189
 
190
190
  it "renders the time as a YYYY-MM-DD HH:MM" do
@@ -210,7 +210,7 @@ describe 'datetime_picker input' do
210
210
  context "when method returns an empty String" do
211
211
 
212
212
  before do
213
- @new_post.stub!(:publish_at).and_return("")
213
+ @new_post.stub(:publish_at).and_return("")
214
214
  end
215
215
 
216
216
  it "will be empty" do
@@ -236,7 +236,7 @@ describe 'datetime_picker input' do
236
236
  context "when method returns a String" do
237
237
 
238
238
  before do
239
- @new_post.stub!(:publish_at).and_return("yeah")
239
+ @new_post.stub(:publish_at).and_return("yeah")
240
240
  end
241
241
 
242
242
  it "will be the string" do
@@ -53,9 +53,9 @@ describe 'hidden input' do
53
53
  end
54
54
 
55
55
  it "should not render inline errors" do
56
- @errors = mock('errors')
57
- @errors.stub!(:[]).with(errors_matcher(:secret)).and_return(["foo", "bah"])
58
- @new_post.stub!(:errors).and_return(@errors)
56
+ @errors = double('errors')
57
+ @errors.stub(:[]).with(errors_matcher(:secret)).and_return(["foo", "bah"])
58
+ @new_post.stub(:errors).and_return(@errors)
59
59
 
60
60
  concat(semantic_form_for(@new_post) do |builder|
61
61
  concat(builder.input(:secret, :as => :hidden))
@@ -9,8 +9,8 @@ describe "*select: options[:include_blank]" do
9
9
  @output_buffer = ''
10
10
  mock_everything
11
11
 
12
- @new_post.stub!(:author_id).and_return(nil)
13
- @new_post.stub!(:publish_at).and_return(nil)
12
+ @new_post.stub(:author_id).and_return(nil)
13
+ @new_post.stub(:publish_at).and_return(nil)
14
14
  end
15
15
 
16
16
  SELECT_INPUT_TYPES = {
@@ -9,7 +9,7 @@ describe 'number input' do
9
9
  @output_buffer = ''
10
10
  mock_everything
11
11
 
12
- @new_post.class.stub!(:validators_on).with(:title).and_return([
12
+ @new_post.class.stub(:validators_on).with(:title).and_return([
13
13
  active_model_numericality_validator([:title], {:only_integer=>false, :allow_nil=>false, :greater_than=>2})
14
14
  ])
15
15
  end
@@ -109,7 +109,7 @@ describe 'number input' do
109
109
 
110
110
  describe "when validations require a minimum value (:greater_than)" do
111
111
  before do
112
- @new_post.class.stub!(:validators_on).with(:title).and_return([
112
+ @new_post.class.stub(:validators_on).with(:title).and_return([
113
113
  active_model_numericality_validator([:title], {:only_integer=>false, :allow_nil=>false, :greater_than=>2})
114
114
  ])
115
115
  end
@@ -144,7 +144,7 @@ describe 'number input' do
144
144
 
145
145
  describe "and the column is an integer" do
146
146
  before do
147
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :integer))
147
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => :integer))
148
148
  end
149
149
 
150
150
  it "should add a min attribute to the input one greater than the validation" do
@@ -157,7 +157,7 @@ describe 'number input' do
157
157
 
158
158
  describe "and the column is a float" do
159
159
  before do
160
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :float))
160
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => :float))
161
161
  end
162
162
 
163
163
  it "should raise an error" do
@@ -171,7 +171,7 @@ describe 'number input' do
171
171
 
172
172
  describe "and the column is a big decimal" do
173
173
  before do
174
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :decimal))
174
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => :decimal))
175
175
  end
176
176
 
177
177
  it "should raise an error" do
@@ -187,7 +187,7 @@ describe 'number input' do
187
187
 
188
188
  describe "when validations require a minimum value (:greater_than) that takes a proc" do
189
189
  before do
190
- @new_post.class.stub!(:validators_on).with(:title).and_return([
190
+ @new_post.class.stub(:validators_on).with(:title).and_return([
191
191
  active_model_numericality_validator([:title], {:only_integer=>false, :allow_nil=>false, :greater_than=> Proc.new {|post| 2}})
192
192
  ])
193
193
  end
@@ -222,7 +222,7 @@ describe 'number input' do
222
222
 
223
223
  describe "and the column is an integer" do
224
224
  before do
225
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :integer))
225
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => :integer))
226
226
  end
227
227
 
228
228
  it "should add a min attribute to the input one greater than the validation" do
@@ -235,7 +235,7 @@ describe 'number input' do
235
235
 
236
236
  describe "and the column is a float" do
237
237
  before do
238
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :float))
238
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => :float))
239
239
  end
240
240
 
241
241
  it "should raise an error" do
@@ -249,7 +249,7 @@ describe 'number input' do
249
249
 
250
250
  describe "and the column is a big decimal" do
251
251
  before do
252
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :decimal))
252
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => :decimal))
253
253
  end
254
254
 
255
255
  it "should raise an error" do
@@ -265,7 +265,7 @@ describe 'number input' do
265
265
 
266
266
  describe "when validations require a minimum value (:greater_than_or_equal_to)" do
267
267
  before do
268
- @new_post.class.stub!(:validators_on).with(:title).and_return([
268
+ @new_post.class.stub(:validators_on).with(:title).and_return([
269
269
  active_model_numericality_validator([:title], {:only_integer=>false, :allow_nil=>false, :greater_than_or_equal_to=>2})
270
270
  ])
271
271
  end
@@ -302,7 +302,7 @@ describe 'number input' do
302
302
  [:integer, :decimal, :float].each do |column_type|
303
303
  describe "and the column is a #{column_type}" do
304
304
  before do
305
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => column_type))
305
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => column_type))
306
306
  end
307
307
 
308
308
  it "should add a max attribute to the input equal to the validation" do
@@ -316,7 +316,7 @@ describe 'number input' do
316
316
 
317
317
  describe "and there is no column" do
318
318
  before do
319
- @new_post.stub!(:column_for_attribute).with(:title).and_return(nil)
319
+ @new_post.stub(:column_for_attribute).with(:title).and_return(nil)
320
320
  end
321
321
 
322
322
  it "should add a max attribute to the input equal to the validation" do
@@ -330,7 +330,7 @@ describe 'number input' do
330
330
 
331
331
  describe "when validations require a minimum value (:greater_than_or_equal_to) that takes a Proc" do
332
332
  before do
333
- @new_post.class.stub!(:validators_on).with(:title).and_return([
333
+ @new_post.class.stub(:validators_on).with(:title).and_return([
334
334
  active_model_numericality_validator([:title], {:only_integer=>false, :allow_nil=>false, :greater_than_or_equal_to=> Proc.new { |post| 2}})
335
335
  ])
336
336
  end
@@ -367,7 +367,7 @@ describe 'number input' do
367
367
  [:integer, :decimal, :float].each do |column_type|
368
368
  describe "and the column is a #{column_type}" do
369
369
  before do
370
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => column_type))
370
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => column_type))
371
371
  end
372
372
 
373
373
  it "should add a max attribute to the input equal to the validation" do
@@ -381,7 +381,7 @@ describe 'number input' do
381
381
 
382
382
  describe "and there is no column" do
383
383
  before do
384
- @new_post.stub!(:column_for_attribute).with(:title).and_return(nil)
384
+ @new_post.stub(:column_for_attribute).with(:title).and_return(nil)
385
385
  end
386
386
 
387
387
  it "should add a max attribute to the input equal to the validation" do
@@ -396,7 +396,7 @@ describe 'number input' do
396
396
  describe "when validations require a maximum value (:less_than)" do
397
397
 
398
398
  before do
399
- @new_post.class.stub!(:validators_on).with(:title).and_return([
399
+ @new_post.class.stub(:validators_on).with(:title).and_return([
400
400
  active_model_numericality_validator([:title], {:only_integer=>false, :allow_nil=>false, :less_than=>20})
401
401
  ])
402
402
  end
@@ -431,7 +431,7 @@ describe 'number input' do
431
431
 
432
432
  describe "and the column is an integer" do
433
433
  before do
434
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :integer))
434
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => :integer))
435
435
  end
436
436
 
437
437
  it "should add a max attribute to the input one greater than the validation" do
@@ -444,7 +444,7 @@ describe 'number input' do
444
444
 
445
445
  describe "and the column is a float" do
446
446
  before do
447
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :float))
447
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => :float))
448
448
  end
449
449
 
450
450
  it "should raise an error" do
@@ -458,7 +458,7 @@ describe 'number input' do
458
458
 
459
459
  describe "and the column is a big decimal" do
460
460
  before do
461
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :decimal))
461
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => :decimal))
462
462
  end
463
463
 
464
464
  it "should raise an error" do
@@ -471,7 +471,7 @@ describe 'number input' do
471
471
  end
472
472
  describe "and the validator takes a proc" do
473
473
  before do
474
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :decimal))
474
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => :decimal))
475
475
  end
476
476
  end
477
477
  end
@@ -479,7 +479,7 @@ describe 'number input' do
479
479
  describe "when validations require a maximum value (:less_than) that takes a Proc" do
480
480
 
481
481
  before do
482
- @new_post.class.stub!(:validators_on).with(:title).and_return([
482
+ @new_post.class.stub(:validators_on).with(:title).and_return([
483
483
  active_model_numericality_validator([:title], {:only_integer=>false, :allow_nil=>false, :less_than=> Proc.new {|post| 20 }})
484
484
  ])
485
485
  end
@@ -514,7 +514,7 @@ describe 'number input' do
514
514
 
515
515
  describe "and the column is an integer" do
516
516
  before do
517
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :integer))
517
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => :integer))
518
518
  end
519
519
 
520
520
  it "should add a max attribute to the input one greater than the validation" do
@@ -527,7 +527,7 @@ describe 'number input' do
527
527
 
528
528
  describe "and the column is a float" do
529
529
  before do
530
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :float))
530
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => :float))
531
531
  end
532
532
 
533
533
  it "should raise an error" do
@@ -541,7 +541,7 @@ describe 'number input' do
541
541
 
542
542
  describe "and the column is a big decimal" do
543
543
  before do
544
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :decimal))
544
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => :decimal))
545
545
  end
546
546
 
547
547
  it "should raise an error" do
@@ -554,7 +554,7 @@ describe 'number input' do
554
554
  end
555
555
  describe "and the validator takes a proc" do
556
556
  before do
557
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :decimal))
557
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => :decimal))
558
558
  end
559
559
  end
560
560
  end
@@ -562,7 +562,7 @@ describe 'number input' do
562
562
 
563
563
  describe "when validations require a maximum value (:less_than_or_equal_to)" do
564
564
  before do
565
- @new_post.class.stub!(:validators_on).with(:title).and_return([
565
+ @new_post.class.stub(:validators_on).with(:title).and_return([
566
566
  active_model_numericality_validator([:title], {:only_integer=>false, :allow_nil=>false, :less_than_or_equal_to=>20})
567
567
  ])
568
568
  end
@@ -598,7 +598,7 @@ describe 'number input' do
598
598
  [:integer, :decimal, :float].each do |column_type|
599
599
  describe "and the column is a #{column_type}" do
600
600
  before do
601
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => column_type))
601
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => column_type))
602
602
  end
603
603
 
604
604
  it "should add a max attribute to the input equal to the validation" do
@@ -612,7 +612,7 @@ describe 'number input' do
612
612
 
613
613
  describe "and there is no column" do
614
614
  before do
615
- @new_post.stub!(:column_for_attribute).with(:title).and_return(nil)
615
+ @new_post.stub(:column_for_attribute).with(:title).and_return(nil)
616
616
  end
617
617
 
618
618
  it "should add a max attribute to the input equal to the validation" do
@@ -626,7 +626,7 @@ describe 'number input' do
626
626
 
627
627
  describe "when validations require a maximum value (:less_than_or_equal_to) that takes a proc" do
628
628
  before do
629
- @new_post.class.stub!(:validators_on).with(:title).and_return([
629
+ @new_post.class.stub(:validators_on).with(:title).and_return([
630
630
  active_model_numericality_validator([:title], {:only_integer=>false, :allow_nil=>false, :less_than_or_equal_to=> Proc.new { |post| 20 }})
631
631
  ])
632
632
  end
@@ -662,7 +662,7 @@ describe 'number input' do
662
662
  [:integer, :decimal, :float].each do |column_type|
663
663
  describe "and the column is a #{column_type}" do
664
664
  before do
665
- @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => column_type))
665
+ @new_post.stub(:column_for_attribute).with(:title).and_return(double('column', :type => column_type))
666
666
  end
667
667
 
668
668
  it "should add a max attribute to the input equal to the validation" do
@@ -676,7 +676,7 @@ describe 'number input' do
676
676
 
677
677
  describe "and there is no column" do
678
678
  before do
679
- @new_post.stub!(:column_for_attribute).with(:title).and_return(nil)
679
+ @new_post.stub(:column_for_attribute).with(:title).and_return(nil)
680
680
  end
681
681
 
682
682
  it "should add a max attribute to the input equal to the validation" do
@@ -690,7 +690,7 @@ describe 'number input' do
690
690
 
691
691
  describe "when validations require conflicting minimum values (:greater_than, :greater_than_or_equal_to)" do
692
692
  before do
693
- @new_post.class.stub!(:validators_on).with(:title).and_return([
693
+ @new_post.class.stub(:validators_on).with(:title).and_return([
694
694
  active_model_numericality_validator([:title], {:only_integer=>false, :allow_nil=>false, :greater_than => 20, :greater_than_or_equal_to=>2})
695
695
  ])
696
696
  end
@@ -705,7 +705,7 @@ describe 'number input' do
705
705
 
706
706
  describe "when validations require conflicting maximum values (:less_than, :less_than_or_equal_to)" do
707
707
  before do
708
- @new_post.class.stub!(:validators_on).with(:title).and_return([
708
+ @new_post.class.stub(:validators_on).with(:title).and_return([
709
709
  active_model_numericality_validator([:title], {:only_integer=>false, :allow_nil=>false, :less_than => 20, :less_than_or_equal_to=>2})
710
710
  ])
711
711
  end
@@ -721,7 +721,7 @@ describe 'number input' do
721
721
  describe "when validations require only an integer (:only_integer)" do
722
722
 
723
723
  before do
724
- @new_post.class.stub!(:validators_on).with(:title).and_return([
724
+ @new_post.class.stub(:validators_on).with(:title).and_return([
725
725
  active_model_numericality_validator([:title], {:allow_nil=>false, :only_integer=>true})
726
726
  ])
727
727
  end
@@ -752,7 +752,7 @@ describe 'number input' do
752
752
  describe "when validations require a :step (non standard)" do
753
753
 
754
754
  before do
755
- @new_post.class.stub!(:validators_on).with(:title).and_return([
755
+ @new_post.class.stub(:validators_on).with(:title).and_return([
756
756
  active_model_numericality_validator([:title], {:allow_nil=>false, :only_integer=>true, :step=>2})
757
757
  ])
758
758
  end
@@ -783,7 +783,7 @@ describe 'number input' do
783
783
  describe "when validations do not specify :step (non standard) or :only_integer" do
784
784
 
785
785
  before do
786
- @new_post.class.stub!(:validators_on).with(:title).and_return([
786
+ @new_post.class.stub(:validators_on).with(:title).and_return([
787
787
  active_model_numericality_validator([:title], {:allow_nil=>false})
788
788
  ])
789
789
  end
@@ -158,7 +158,7 @@ describe 'radio input' do
158
158
  ::I18n.backend.store_translations :en, :formtastic => { :labels => { :post => { :authors => "Translated!" }}}
159
159
 
160
160
  with_config :i18n_lookups_by_default, true do
161
- @new_post.stub!(:author_ids).and_return(nil)
161
+ @new_post.stub(:author_ids).and_return(nil)
162
162
  concat(semantic_form_for(@new_post) do |builder|
163
163
  concat(builder.input(:authors, :as => :radio))
164
164
  end)
@@ -177,7 +177,7 @@ describe 'radio input' do
177
177
 
178
178
  describe "when :label option is set" do
179
179
  before do
180
- @new_post.stub!(:author_ids).and_return(nil)
180
+ @new_post.stub(:author_ids).and_return(nil)
181
181
  concat(semantic_form_for(@new_post) do |builder|
182
182
  concat(builder.input(:authors, :as => :radio, :label => 'The authors'))
183
183
  end)
@@ -191,7 +191,7 @@ describe 'radio input' do
191
191
  describe "when :label option is false" do
192
192
  before do
193
193
  @output_buffer = ''
194
- @new_post.stub!(:author_ids).and_return(nil)
194
+ @new_post.stub(:author_ids).and_return(nil)
195
195
  concat(semantic_form_for(@new_post) do |builder|
196
196
  concat(builder.input(:authors, :as => :radio, :label => false))
197
197
  end)
@@ -209,7 +209,7 @@ describe 'radio input' do
209
209
 
210
210
  describe "when :required option is true" do
211
211
  before do
212
- @new_post.stub!(:author_ids).and_return(nil)
212
+ @new_post.stub(:author_ids).and_return(nil)
213
213
  concat(semantic_form_for(@new_post) do |builder|
214
214
  concat(builder.input(:authors, :as => :radio, :required => true))
215
215
  end)
@@ -223,7 +223,7 @@ describe 'radio input' do
223
223
  describe "when :namespace is given on form" do
224
224
  before do
225
225
  @output_buffer = ''
226
- @new_post.stub!(:author_ids).and_return(nil)
226
+ @new_post.stub(:author_ids).and_return(nil)
227
227
  concat(semantic_form_for(@new_post, :namespace => "custom_prefix") do |builder|
228
228
  concat(builder.input(:authors, :as => :radio, :label => ''))
229
229
  end)
@@ -279,4 +279,22 @@ describe 'radio input' do
279
279
  end
280
280
  end
281
281
 
282
+ describe "when collection contains symbols" do
283
+ before do
284
+ @output_buffer = ''
285
+ mock_everything
286
+
287
+ concat(semantic_form_for(:project) do |builder|
288
+ concat(builder.input(:author_id, :as => :radio, :collection => Set.new([["A", :a], ["B", :b], ["C", :c]])))
289
+ end)
290
+ end
291
+
292
+ it 'should output the correct labels' do
293
+ output_buffer.should have_tag("li.choice label", /A/)
294
+ output_buffer.should have_tag("li.choice label", /B/)
295
+ output_buffer.should have_tag("li.choice label", /C/)
296
+ end
297
+ end
298
+
299
+
282
300
  end