/
numeric_input_spec.rb
41 lines (33 loc) · 1.03 KB
/
numeric_input_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
37
38
39
40
# encoding: utf-8
require 'spec_helper'
describe 'numeric input' do
include FormtasticSpecHelper
before do
@output_buffer = ''
mock_everything
end
it "should call NumberInput.new" do
input = mock('input', :to_html => "HTML codez")
::Formtastic::Inputs::NumericInput.should_receive(:new).and_return(input)
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :numeric))
end)
end
it "should have an li.numeric" do
with_deprecation_silenced do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :numeric))
end)
end
output_buffer.should have_tag('li.numeric')
output_buffer.should have_tag('li.input')
end
it "should warn that :numeric is deprecated in favor of :number" do
::ActiveSupport::Deprecation.should_receive(:warn)
with_deprecation_silenced do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :numeric))
end)
end
end
end