-
Notifications
You must be signed in to change notification settings - Fork 10
/
date_picker_text_field_spec.rb
36 lines (28 loc) · 1.21 KB
/
date_picker_text_field_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require File.dirname(__FILE__) + '/spec_helper'
describe "a unobtrusive_date_text_picker with a stub ActiveRecord object" do
it_should_behave_like "all date picker helpers"
before(:each) do
@date = Date.parse("March 15, 2007")
@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='15-03-2007']")
end
after(:each) do
@date, @date_model, @datepicker_html = nil
end
end
describe "a unobtrusive_date_text_picker_tag with a stub ActiveRecord object" do
it_should_behave_like "all date picker helpers"
before(:each) do
@date = Date.parse("March 15, 2007")
@datepicker_html = unobtrusive_date_text_picker_tag(:date_value, @date, :divider => '.')
end
it "should have all the correct classes and attributes" do
@datepicker_html.should selector_tag("input#date_value.format-m-d-y.divider-dot[type='text'][value='03.15.2007']")
end
after(:each) do
@date, @datepicker_html = nil
end
end