Sha256: 562fc4ac44fb4c792e89a7cb63521813d942ee9d1f764d10d6b54375ded8bfca

Contents?: true

Size: 1.14 KB

Versions: 8

Compression:

Stored size: 1.14 KB

Contents

require "spec_helper"

module BitCore
  describe ContentProvider do
    describe "validations" do
      it "should validate the existence of the template path" do
        p = ContentProvider.new(template_path: "foobaz")
        p.valid?

        expect(p.errors[:template_path].length).to eq 1

        p.template_path = "layouts"
        p.valid?

        expect(p.errors[:template_path].length).to eq 0
      end

      it "should validate the existence of the data class" do
        p = ContentProvider.new(data_class_name: "foobaz")
        p.valid?

        expect(p.errors[:data_class_name].length).to eq 1

        p.data_class_name = "BitCore::ContentProvider"
        p.valid?

        expect(p.errors[:data_class_name].length).to eq 0
      end

      it "should validate the existence of the data attributes" do
        p = ContentProvider.new(
          data_class_name: "BitCore::Tool",
          data_attributes: %w(baz)
        )
        p.valid?

        expect(p.errors[:data_attributes].length).to eq 1

        p.data_attributes = %w(id title)
        p.valid?

        expect(p.errors[:data_attributes].length).to eq 0
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bit_core-2.0.0.beta1 spec/models/bit_core/content_provider_spec.rb
bit_core-1.4.6 spec/models/bit_core/content_provider_spec.rb
bit_core-1.4.5 spec/models/bit_core/content_provider_spec.rb
bit_core-1.2.2 spec/models/bit_core/content_provider_spec.rb
bit_core-1.2.1 spec/models/bit_core/content_provider_spec.rb
bit_core-1.2.0 spec/models/bit_core/content_provider_spec.rb
bit_core-1.1.6 spec/models/bit_core/content_provider_spec.rb
bit_core-1.1.5 spec/models/bit_core/content_provider_spec.rb