Sha256: fab70a540f131d14e0530c39cedbd1ec16f0b10c33fca40f543196ab7c5f3180

Contents?: true

Size: 922 Bytes

Versions: 17

Compression:

Stored size: 922 Bytes

Contents

require 'spec_helper'
 
describe ContentInstance do
  
  before(:each) do
    Site.any_instance.stubs(:create_default_pages!).returns(true)
    @content_type = Factory.build(:content_type)
    @content_type.content_custom_fields.build :label => 'Title', :kind => 'String'
    @content_type.content_custom_fields.build :label => 'Description', :kind => 'Text'
    @content_type.highlighted_field_name = 'custom_field_1'
  end

  context 'when validating' do
  
    it 'should be valid' do
      build_content.should be_valid
    end
  
    # Validations ##
    
    it 'should validate presence of title' do
      content = build_content :title => nil
      content.should_not be_valid
      content.errors[:title].should == ["can't be blank"]
    end
    
  end
  
  def build_content(options = {})
    @content_type.contents.build({ :title => 'Locomotive', :description => 'Lorem ipsum....' }.merge(options))
  end
  
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
locomotive_cms-0.0.3.3 spec/models/content_instance_spec.rb
locomotive_cms-0.0.3.1 spec/models/content_instance_spec.rb
locomotive_cms-0.0.2.9 spec/models/content_instance_spec.rb
locomotive_cms-0.0.2.8 spec/models/content_instance_spec.rb
locomotive_cms-0.0.2.7 spec/models/content_instance_spec.rb
locomotive_cms-0.0.2.6 spec/models/content_instance_spec.rb
locomotive_cms-0.0.2.5 spec/models/content_instance_spec.rb
locomotive_cms-0.0.2.4 spec/models/content_instance_spec.rb
locomotive_cms-0.0.2.3 spec/models/content_instance_spec.rb
locomotive_cms-0.0.2.2 spec/models/content_instance_spec.rb
locomotive_cms-0.0.2.1 spec/models/content_instance_spec.rb
locomotive_cms-0.0.2 spec/models/content_instance_spec.rb
locomotive_cms-0.0.1.4 spec/models/content_instance_spec.rb
locomotive_cms-0.0.1.3 spec/models/content_instance_spec.rb
locomotive_cms-0.0.1.2 spec/models/content_instance_spec.rb
locomotive_cms-0.0.1.1 spec/models/content_instance_spec.rb
locomotive_cms-0.0.1 spec/models/content_instance_spec.rb