Sha256: 0868c9b7dfd02c7e439bd8ecd6afe820ea360459d23b1de83f4b295131876a47

Contents?: true

Size: 696 Bytes

Versions: 6

Compression:

Stored size: 696 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Layout do
  scenario :layouts
  test_helper :validations
  
  before :each do
    @layout = @model = Layout.new(layout_params)
  end
  
  it 'should validate presence of' do
    assert_valid :name, 'Just a Test'
    assert_invalid :name, 'required', nil, '', '  '
  end
  
  it 'should validate uniqueness of' do
    assert_invalid :name, 'name already in use', 'Main'
    assert_valid :name, 'Something Else'
  end
  
  it 'should validate length of' do
    {
      :name => 100
    }.each do |field, max|
      assert_invalid field, ('%d-character limit' % max), 'x' * (max + 1)
      assert_valid field, 'x' * max
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
radiant-0.6.5.1 spec/models/layout_spec.rb
radiant-0.6.5 spec/models/layout_spec.rb
radiant-0.6.7 spec/models/layout_spec.rb
radiant-0.6.6 spec/models/layout_spec.rb
radiant-0.6.8 spec/models/layout_spec.rb
radiant-0.6.9 spec/models/layout_spec.rb