Sha256: a317bc92aafb8d2354bf9b32f7987dc7d1f07ad83621e3b302b263cb9396969d

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

module Tim
  describe TemplateValidator do
    it "should not add errors on template with valid xml" do
      template = FactoryGirl.build(:template)
      TemplateValidator.new({}).validate(template)
      template.errors.size.should == 0
    end

    it "should add errors to template with invalid xml" do
      template = FactoryGirl.build(:template, 
                                   :xml => "<invalid_template>
                                            </invalid_template>")
      TemplateValidator.new({}).validate(template)
      template.errors.size.should > 0
    end

    it "should add xml syntax errors to template errors" do
      template = FactoryGirl.build(:template,
                                   :xml => "<invalid_template>
                                            </invalid_template")
      TemplateValidator.new({}).validate(template)
      template.errors.size.should > 0
      template.errors.messages.first.to_s
        .include?("Syntax error on line 2").should == true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tim-0.3.0 spec/validators/template_validator_spec.rb
tim-0.2.0 spec/validators/template_validator_spec.rb