Sha256: 8ab5c08c39df9a57f265a5bdf6bb745ff3a3c2d39519f074ae622a0e5e239d2c

Contents?: true

Size: 1.08 KB

Versions: 9

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe Alephant::Publisher::ViewMapper do
  let(:component_id) { :foo }
  let(:data) {{ :foo => :bar }}
  let(:path) { File.join(File.dirname(__FILE__), 'fixtures/components') }

  subject { Alephant::Publisher::ViewMapper }

  describe "initialize(view_base_path)" do
    context "view_base_path = invalid_path" do
      it "should raise an error" do
        expect {
          subject.new(component_id, './invalid_path')
        }.to raise_error
      end
    end

    context "view_base_path = '.'" do
      it "sets base_path" do
        expect(
          subject.new(component_id, path).base_path
        ).to eq("#{path}/#{component_id}")
      end
    end

    context "view_base_path = nil" do
      it "sets base_path" do
        expect(
          subject.new(component_id).base_path
        ).to eq(Alephant::Publisher::ViewMapper::DEFAULT_LOCATION)
      end
    end
  end

  describe "generate(data)" do
    it "calls create_renderer for each template found" do
      expect(
        subject.new(component_id, path).generate(data).size
      ).to eq(3)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
alephant-publisher-0.6.10 spec/view_mapper_spec.rb
alephant-publisher-0.6.9 spec/view_mapper_spec.rb
alephant-publisher-0.6.8 spec/view_mapper_spec.rb
alephant-publisher-0.6.7 spec/view_mapper_spec.rb
alephant-publisher-0.6.6 spec/view_mapper_spec.rb
alephant-publisher-0.6.5 spec/view_mapper_spec.rb
alephant-publisher-0.6.4 spec/view_mapper_spec.rb
alephant-publisher-0.6.3 spec/view_mapper_spec.rb
alephant-publisher-0.6.2 spec/view_mapper_spec.rb