Sha256: 13b0dd2159723cf6f67a6d39565acb35d16e89d7c825fb75a740417cd612dec6

Contents?: true

Size: 1020 Bytes

Versions: 2

Compression:

Stored size: 1020 Bytes

Contents

require '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

2 entries across 2 versions & 1 rubygems

Version Path
radiant-templates-extension-1.0.8 spec/models/template_part_spec.rb
radiant-templates-extension-1.0.7 spec/models/template_part_spec.rb