Sha256: 26ccb4351cbffd1a10e47985b72e1c80136419fce39f2b220db9c7541a039c0f

Contents?: true

Size: 1.03 KB

Versions: 8

Compression:

Stored size: 1.03 KB

Contents

# 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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
formtastic-2.0.2 spec/inputs/numeric_input_spec.rb
formtastic-2.0.1 spec/inputs/numeric_input_spec.rb
formtastic-2.0.0 spec/inputs/numeric_input_spec.rb
formtastic-2.0.0.rc5 spec/inputs/numeric_input_spec.rb
formtastic-2.0.0.rc4 spec/inputs/numeric_input_spec.rb
formtastic-2.0.0.rc3 spec/inputs/numeric_input_spec.rb
formtastic-2.0.0.rc2 spec/inputs/numeric_input_spec.rb
formtastic-2.0.0.rc1 spec/inputs/numeric_input_spec.rb