Sha256: 791d550936206c569f8997e6c4db62258242461d9e34d84898e8cb27b7d8aaea

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

require 'spec_helper'

describe 'deprecated time, datetime and date inputs' do
  include FormtasticSpecHelper
  
  before do
    @output_buffer = ''
    mock_everything
  end
  
  it 'should warn :time is deprecated' do
    ::ActiveSupport::Deprecation.should_receive(:warn)
    semantic_form_for(@new_post) do |f|
      concat(f.input :created_at, :as => :time)
    end
  end

  it 'should warn :datetime is deprecated' do
    ::ActiveSupport::Deprecation.should_receive(:warn)
    semantic_form_for(@new_post) do |f|
      concat(f.input :created_at, :as => :datetime)
    end
  end
  
  it 'should warn :date is deprecated' do
    ::ActiveSupport::Deprecation.should_receive(:warn)
    semantic_form_for(@new_post) do |f|
      concat(f.input :created_at, :as => :date)
    end
  end
  
  it 'should use wrapper css class based off :as, not off their parent class' do
    with_deprecation_silenced do
      concat(semantic_form_for(@new_post) do |f|
        concat(f.input :created_at, :as => :time)
        concat(f.input :created_at, :as => :datetime)
        concat(f.input :created_at, :as => :date)
      end)
    end
    output_buffer.should have_tag('div.control-group.time')
    output_buffer.should have_tag('div.control-group.datetime')
    output_buffer.should have_tag('div.control-group.date')
    output_buffer.should_not have_tag('li.time_select')
    output_buffer.should_not have_tag('li.datetime_select')
    output_buffer.should_not have_tag('li.date_select')
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
formtastic-bootstrap-2.0.0 spec/inputs/deprecated_time_date_datetime_inputs_spec.rb