Sha256: 03eb0d2b884ee0c0ca4852e80ff26b596016983819b2fd2dc7e67ec17c7bc9c9

Contents?: true

Size: 1.34 KB

Versions: 5

Compression:

Stored size: 1.34 KB

Contents

# coding: utf-8
require 'spec_helper'

describe 'numeric input' do
  
  include FormtasticSpecHelper
  
  before do
    @output_buffer = ''
    mock_everything
    
    @form = semantic_form_for(@new_post) do |builder|
      concat(builder.input(:title, :as => :numeric))
    end
  end

  it_should_have_input_wrapper_with_class(:numeric)
  it_should_have_input_wrapper_with_id("post_title_input")
  it_should_have_label_with_text(/Title/)
  it_should_have_label_for("post_title")
  it_should_have_input_with_id("post_title")
  it_should_have_input_with_type(:text)
  it_should_have_input_with_name("post[title]")
  it_should_use_default_text_field_size_when_method_has_no_database_column(:string)
  it_should_apply_custom_input_attributes_when_input_html_provided(:string)
  it_should_apply_custom_for_to_label_when_input_html_id_provided(:string)
  it_should_apply_error_logic_for_input_type(:numeric)
  
  describe "when no object is provided" do
    before do
      @form = semantic_form_for(:project, :url => 'http://test.host/') do |builder|
        concat(builder.input(:title, :as => :numeric))
      end
    end
    
    it_should_have_label_with_text(/Title/)
    it_should_have_label_for("project_title")
    it_should_have_input_with_id("project_title")
    it_should_have_input_with_type(:text)
    it_should_have_input_with_name("project[title]")
  end
  
end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
formtastic-1.1.0 spec/inputs/numeric_input_spec.rb
formtastic-1.1.0.beta spec/inputs/numeric_input_spec.rb
sensis-formtastic-rails3-1.d4e5326 spec/inputs/numeric_input_spec.rb
techthumb-formtastic-1.rails3.sha spec/inputs/numeric_input_spec.rb
formtastic-rails3-1.0.0.beta3 spec/inputs/numeric_input_spec.rb