Sha256: 32fa04777bea342fe9d59a4c1b763c01c65a9a20e67b28c97fd1450de6a8fc46

Contents?: true

Size: 942 Bytes

Versions: 5

Compression:

Stored size: 942 Bytes

Contents

# coding: utf-8
require 'spec_helper'

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

  it_should_have_input_wrapper_with_class("file")
  it_should_have_input_wrapper_with_id("post_body_input")
  it_should_have_label_with_text(/Body/)
  it_should_have_label_for("post_body")
  it_should_have_input_with_id("post_body")
  it_should_have_input_with_name("post[body]")
  it_should_apply_error_logic_for_input_type(:file)

  it 'should use input_html to style inputs' do
    form = semantic_form_for(@new_post) do |builder|
      concat(builder.input(:title, :as => :file, :input_html => { :class => 'myclass' }))
    end
    output_buffer.concat(form) if Formtastic::Util.rails3?
    output_buffer.should have_tag("form li input.myclass")
  end

end

Version data entries

5 entries across 5 versions & 4 rubygems

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