semanticgap_date_time_form 0.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -94,5 +94,18 @@ describe SemanticGap::DateTimeForm::FormBuilderMixin do
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
97
|
+
|
98
|
+
[ 2, '2' ].each do |month|
|
99
|
+
context "when month is #{month.inspect}" do
|
100
|
+
before(:each) do
|
101
|
+
@fields.month = month
|
102
|
+
@result = subject.datetime_form(:published_at)
|
103
|
+
end
|
104
|
+
|
105
|
+
it "has an option for the selected month" do
|
106
|
+
@result.should have_tag('option[value=?][selected=selected]', month)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
97
110
|
end
|
98
111
|
end
|
data/spec/unit/form_spec.rb
CHANGED
@@ -580,4 +580,22 @@ describe SemanticGap::DateTimeForm::Form do
|
|
580
580
|
end
|
581
581
|
end
|
582
582
|
end
|
583
|
+
|
584
|
+
describe '#month' do
|
585
|
+
{ 1 => 1,
|
586
|
+
'1' => 1,
|
587
|
+
'aaa' => 'aaa',
|
588
|
+
:hello => :hello
|
589
|
+
}.each do |value, expecting|
|
590
|
+
context 'when month is set to #{value.inspect}' do
|
591
|
+
before(:each) do
|
592
|
+
subject.month = value
|
593
|
+
end
|
594
|
+
|
595
|
+
it "returns #{expecting}" do
|
596
|
+
subject.month.should == expecting
|
597
|
+
end
|
598
|
+
end
|
599
|
+
end
|
600
|
+
end
|
583
601
|
end
|