Sha256: ffc879db7feae76457f986e6efbc4dd7bfbf16edce03129f3908a2317bc7f311

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require "spec_helper"

module BitPlayer
  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 = "BitPlayer::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: "BitPlayer::ContentProvider",
          data_attributes: ["baz"]
        )
        p.valid?

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

        p.data_attributes = ["id", "data_attributes"]
        p.valid?

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bit_player-0.3.0 spec/models/bit_player/content_provider_spec.rb