Sha256: a5e14ac9b6b26f49b21d86b43f95dd786d24a88a8fa711edd8d5e404a0289a08

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

describe Stevenson::TemplateLoader do
  subject { Stevenson::TemplateLoader }

  describe '.load' do
    context 'when given a template alias' do
      let(:template_alias) { 'hyde-base' }
      let(:template) { subject.load template_alias }

      it 'returns the appropriate template' do
        expect(template).to be_an_instance_of Stevenson::Templates::GitTemplate
      end

      after do
        Dir.mktmpdir do |dir|
          template.output dir
        end
      end
    end

    context 'when given a git url' do
      let(:url) { 'https://github.com/RootsRated/stevenson-base-template.git' }
      let(:template) { subject.load url }

      it 'returns the appropriate template' do
        expect(template).to be_an_instance_of Stevenson::Templates::GitTemplate
      end

      after do
        Dir.mktmpdir do |dir|
          template.output dir
        end
      end
    end

    context 'when given a path' do
      let(:path) { Dir.mktmpdir }
      let(:template) { subject.load path }

      it 'returns the appropriate template' do
        expect(template).to be_an_instance_of Stevenson::Templates::Base
      end

      after do
        FileUtils.remove_entry_secure path
        Dir.mktmpdir do |dir|
          template.output dir
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stevenson-1.0.1 spec/template_loader_spec.rb
stevenson-1.0.0 spec/template_loader_spec.rb