Sha256: e12368bdc5fdf61d6cb854be7764b7ab05333488adfda62e20bef9ff10b8d18a

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

# typed: false
# frozen_string_literal: true

require './spec/spec_setup'
require 'lib/frontman/app'
require 'lib/frontman/sitemap_tree'

describe Frontman::App do
  subject { Frontman::App.instance }

  context 'Helpers' do
    it 'should register helpers correctly' do
      # TODO: make test
    end

    it 'should throw an error when registering a missing helpers' do
      expect do
        subject.register_helpers(
          [
            { path: File.join(Dir.pwd, 'helpers/MissingHelper.rb'), name: 'MissingHelper' }
          ]
        )
      end.to raise_error LoadError
    end
  end

  context 'Redirects' do
    it 'should store redirects' do
      subject.add_redirect('/foo', '/bar')
      expect(subject.get_redirect('/foo')).to eq '/bar'
    end
  end

  context 'manifest' do
    it 'should prepend with a slash if needed' do
      expect(subject.add_to_manifest('key', 'foo/bar')).to eq '/foo/bar'
      expect(subject.add_to_manifest('key', '/bar/foo')).to eq '/bar/foo'
    end
  end

  it 'should return a sitemap_tree' do
    expect(subject.sitemap_tree.is_a?(Frontman::SitemapTree)).to eq true
  end

  it 'should return itself when calling app' do
    expect(subject.app).to eq subject
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
frontman-ssg-0.0.3 spec/frontman/app_spec.rb
frontman-ssg-0.0.2 spec/frontman/app_spec.rb