Sha256: e9ec424baaa8a6eef38a7b3ca8a3ac7ed1402ad8346b5587e3a9b7e644548b3a

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

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

describe TemplatePart do
  dataset :part_types
  
  before :each do
    @template_part = TemplatePart.new :template_id => 1, :name => "extended", 
                                    :filter_id => nil, :part_type_id => 1
  end
  
  it "should be valid with correct parameters" do
    @template_part.should be_valid
  end
  
  it "should require a name" do
    @template_part.name = nil
    @template_part.should_not be_valid
    @template_part.should have(1).error_on(:name)
  end
  
  it "should require a part type" do
    @template_part.part_type_id = nil
    @template_part.should_not be_valid
    @template_part.should have(1).error_on(:part_type_id)
  end
  
  it "should disallow 'body' for name" do
    @template_part.name = 'body'
    @template_part.should_not be_valid
    @template_part.should have(1).error_on(:name)
  end
  
  it "should assign a part type by name" do
    @template_part.part_type_name = "Boolean"
    @template_part.part_type.should == part_types(:boolean)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
radiant-templates-extension-1.0.6 spec/models/template_part_spec.rb
radiant-templates-extension-1.0.5 spec/models/template_part_spec.rb
radiant-templates-extension-1.0.4 spec/models/template_part_spec.rb
radiant-templates-extension-1.0.3 spec/models/template_part_spec.rb
radiant-templates-extension-1.0.2 spec/models/template_part_spec.rb
radiant-templates-extension-1.0.1 spec/models/template_part_spec.rb
radiant-templates-extension-1.0.0 spec/models/template_part_spec.rb