Sha256: b2ce3f86a908bec29b7214068d64b3983806d70aabb06669ffb40fbb6a4298b3

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

require "spec_helper"

describe Docks::Themes::API::Components do
  subject { described_class }

  describe ".component_for" do
    it "returns the base component when no custom component class exists" do
      expect(subject.component_for(:foo)).to be subject::Base
    end

    it "returns the custom component class if one exists" do
      expect(subject.component_for(:code_block)).to be subject::CodeBlock
      expect(subject.component_for("code_block")).to be subject::CodeBlock
    end
  end

  describe ".template_path" do
    let(:expected_path) {  }

    it "returns the path to the component's template" do
      path = subject.template_path(:code_block)
      expect(path).to eq Docks::Themes::API.instance.assets.path_for("components/code_block/code_block.erb")
      expect(File.exists?(path)).to be true
    end

    it "returns the path to a nested template" do
      expect(subject.template_path("tablist:tab")).to eq Docks::Themes::API.instance.assets.path_for("components/tablist/tablist_tab.erb")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
docks_theme_api-1.0.3 spec/lib/components_spec.rb
docks_theme_api-1.0.2 spec/lib/components_spec.rb