Sha256: e319ed4e83227e0d2bf116e2e44c264997f019252bb9533c48005de925895958

Contents?: true

Size: 742 Bytes

Versions: 2

Compression:

Stored size: 742 Bytes

Contents

require 'spec_helper'

describe PartType do
  before :each do
    @part_type = PartType.new :name => "Test type", :field_type => 'text_area'
  end

  it "should require a name" do
    @part_type.name = nil
    @part_type.should_not be_valid
    @part_type.should have(1).error_on(:name)
  end

  it "should require a valid field type" do
    @part_type.field_type = 'foobar'
    @part_type.should_not be_valid
    @part_type.should have(1).error_on(:field_type)
  end

  it "should be valid with correct parameters" do
    @part_type.should be_valid
  end

  it "should not allow creation of a new part type with a duplicate name" do
    @new_part_type = PartType.create :name => @part_type.name
    @new_part_type.id.should be_nil
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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