Sha256: 1ad8a32bf94b5614b8dc30ccaf49f1a921825787485d0e88f62771c7f998205b

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

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

describe Formation::Types::Checkbox do
  
  before do
    @field = Formation::Field.new('remember_me', :type => :checkbox)
    @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="checkbox" name="remember_me" value="1" checked="" />
        HTML
      end
      
    end
    
    describe 'with a false value' do
      
      before do
        @field.value = false
      end
      
      it 'should render correctly' do
        @type.to_html.must_equal <<-HTML.strip
          <input type="checkbox" name="remember_me" value="1" checked="" />
        HTML
      end
      
    end
    
    describe 'with a true value' do
      
      before do
        @field.value = true
      end
      
      it 'should render correctly' do
        @type.to_html.must_equal <<-HTML.strip
          <input type="checkbox" name="remember_me" value="1" checked="checked" />
        HTML
      end
      
    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

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