Sha256: 12979872c94d898addd6ff8e0a00391f34b669b6421a9cdb79cd31ae33fecc2d

Contents?: true

Size: 695 Bytes

Versions: 17

Compression:

Stored size: 695 Bytes

Contents

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

describe Layout do
  dataset :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

17 entries across 17 versions & 3 rubygems

Version Path
radiantcms-couchrest_model-0.2.4 spec/models/layout_spec.rb
radiantcms-couchrest_model-0.2.2 spec/models/layout_spec.rb
radiantcms-couchrest_model-0.2.1 spec/models/layout_spec.rb
radiantcms-couchrest_model-0.2 spec/models/layout_spec.rb
radiantcms-couchrest_model-0.1.9 spec/models/layout_spec.rb
radiantcms-couchrest_model-0.1.8 spec/models/layout_spec.rb
radiantcms-couchrest_model-0.1.7 spec/models/layout_spec.rb
radiantcms-couchrest_model-0.1.6 spec/models/layout_spec.rb
radiantcms-couchrest_model-0.1.5 spec/models/layout_spec.rb
radiant-0.7.2 spec/models/layout_spec.rb
radiant-0.8.2 spec/models/layout_spec.rb
radiant-0.9.0.rc2 spec/models/layout_spec.rb
radiant-rc-0.9.0 spec/models/layout_spec.rb
radiant-0.8.1 spec/models/layout_spec.rb
radiant-0.7.0 spec/models/layout_spec.rb
radiant-0.8.0 spec/models/layout_spec.rb
radiant-0.7.1 spec/models/layout_spec.rb