Permalink
Browse files

spec: a unobtrusive_date_text_picker with a ActiveRecord attribute wi…

…th a nil value.
  • Loading branch information...
1 parent 4020553 commit fd15b829a92951c4a7550c0644502587040fdedc @frisoft frisoft committed Jul 10, 2009
Showing with 18 additions and 0 deletions.
  1. +18 −0 spec/date_picker_text_field_spec.rb
@@ -34,3 +34,21 @@
@date, @datepicker_html = nil
end
end
+
+describe "a unobtrusive_date_text_picker with a ActiveRecord attribute with a nil value" do
+ it_should_behave_like "all date picker helpers"
+
+ before(:each) do
+ @date = nil
+ @date_model = stub('DateModel', :date => @date, :id => 1)
+ @datepicker_html = unobtrusive_date_text_picker(:date_model, :date, :format => 'd-m-y', :divider => 'dash')
+ end
+
+ it "should have all the correct classes and attributes" do
+ @datepicker_html.should selector_tag("input#date_model_date.format-d-m-y.divider-dash[type='text'][value='']")
+ end
+
+ after(:each) do
+ @date, @date_model, @datepicker_html = nil
+ end
+end

0 comments on commit fd15b82

Please sign in to comment.