Sha256: de3c0bd414d45da44de5630fcc308e87dc7103d1224afd860a4f5c1b9f77d5fc

Contents?: true

Size: 995 Bytes

Versions: 3

Compression:

Stored size: 995 Bytes

Contents

require 'models/page'
require 'fakefs/spec_helpers'

RSpec.describe Page do
  let(:content) do
    <<-CONTENT
---
title: Test Post
timestamp: 2014-06-22T00:15:50-04:00
tags: test, beginning, randomtag
---

This is a test post. It is title is {{title}}.
CONTENT
  end

  let(:page) { Page.new(content) }

  describe '#permalink' do
    context 'not provided' do
      it 'consists of just the slug' do
        expect(page.permalink).to eq('/test-post.html')
      end
    end

    context 'provided in yaml' do
      let(:custom_permalink_content) do
         <<-CONTENT
---
title: Test Post
timestamp: 2014-06-22T00:15:50-04:00
tags: test, beginning, randomtag
permalink: custom-permalink
---

This is a test post. It is title is {{title}}.
CONTENT
      end

      let (:custom_permalink_page) { Page.new(custom_permalink_content) }

      it 'uses the permalink provided from yaml' do
        expect(custom_permalink_page.permalink).to eq('/custom-permalink.html')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ignoramos-1.1.0 spec/models/page_spec.rb
ignoramos-1.0.1 spec/models/page_spec.rb
ignoramos-1.0.0 spec/models/page_spec.rb