Sha256: d15e4c2ee39ab9ab88f1943e26d16e86c8a5cbf17c5e544b25d48f681ddabeaa

Contents?: true

Size: 818 Bytes

Versions: 1

Compression:

Stored size: 818 Bytes

Contents

require File.expand_path('../../test_helper', __FILE__)

describe Formation::Types::Text do
  
  before do
    @field = Formation::Field.new('username', :type => :text)
    @type = @field.type
  end
  
  describe '.to_html' do
    
    describe 'with no value' do
      
      before do
        @field.value = nil
      end
    
      it 'should render correctly' do
        @type.to_html.must_equal <<-HTML.strip
          <input type="text" name="username" value="" />
        HTML
      end
      
    end
    
    describe 'with a value' do
      
      before do
        @field.value = 'chris'
      end
      
      it 'should render correctly' do
        @type.to_html.must_equal <<-HTML.strip
          <input type="text" name="username" value="chris" />
        HTML
      end
      
    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
formation-0.0.1 test/types/text_spec.rb