Sha256: 25ca83230ff6ad0e181643fe074df8f9e092d5ee7fa62a6cf9431dc1527ffa67

Contents?: true

Size: 1.69 KB

Versions: 9

Compression:

Stored size: 1.69 KB

Contents

describe Nanoc::Int::Site do
  describe '#freeze' do
    let(:site) do
      described_class.new(
        config: config,
        code_snippets: code_snippets,
        items: items,
        layouts: layouts,
      )
    end

    let(:config) do
      Nanoc::Int::Configuration.new.with_defaults
    end

    let(:code_snippets) do
      [
        Nanoc::Int::CodeSnippet.new('FOO = 123', 'hello.rb'),
        Nanoc::Int::CodeSnippet.new('BAR = 123', 'hi.rb'),
      ]
    end

    let(:items) do
      Nanoc::Int::IdentifiableCollection.new(config).tap do |coll|
        coll << Nanoc::Int::Item.new('foo', {}, '/foo.md')
        coll << Nanoc::Int::Item.new('bar', {}, '/bar.md')
      end
    end

    let(:layouts) do
      Nanoc::Int::IdentifiableCollection.new(config).tap do |coll|
        coll << Nanoc::Int::Layout.new('foo', {}, '/foo.md')
        coll << Nanoc::Int::Layout.new('bar', {}, '/bar.md')
      end
    end

    before do
      site.freeze
    end

    it 'freezes the configuration' do
      expect(site.config).to be_frozen
    end

    it 'freezes the configuration contents' do
      expect(site.config[:output_dir]).to be_frozen
    end

    it 'freezes items collection' do
      expect(site.items).to be_frozen
    end

    it 'freezes individual items' do
      expect(site.items).to all(be_frozen)
    end

    it 'freezes layouts collection' do
      expect(site.layouts).to be_frozen
    end

    it 'freezes individual layouts' do
      expect(site.layouts).to all(be_frozen)
    end

    it 'freezes code snippets collection' do
      expect(site.code_snippets).to be_frozen
    end

    it 'freezes individual code snippets' do
      expect(site.code_snippets).to all(be_frozen)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
nanoc-4.6.1 spec/nanoc/base/entities/site_spec.rb
nanoc-4.6.0 spec/nanoc/base/entities/site_spec.rb
nanoc-4.5.4 spec/nanoc/base/entities/site_spec.rb
nanoc-4.5.3 spec/nanoc/base/entities/site_spec.rb
nanoc-4.5.2 spec/nanoc/base/entities/site_spec.rb
nanoc-4.5.1 spec/nanoc/base/entities/site_spec.rb
nanoc-4.5.0 spec/nanoc/base/entities/site_spec.rb
nanoc-4.4.7 spec/nanoc/base/entities/site_spec.rb
nanoc-4.4.6 spec/nanoc/base/entities/site_spec.rb