Sha256: cf082597a7258462319e6eed6272c3eb2e4557c2e48497c61ccf5fa64084e511

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 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::ContentProvider",
          data_attributes: %w(baz)
        )
        p.valid?

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bit_core-1.1.4 spec/models/bit_core/content_provider_spec.rb
bit_core-1.1.3 spec/models/bit_core/content_provider_spec.rb
bit_core-1.1.2 spec/models/bit_core/content_provider_spec.rb