Sha256: 044666515a4ec263f69ceeb9134a048e21ab2c104b7c627bf345ae609b5f1fbe

Contents?: true

Size: 947 Bytes

Versions: 2

Compression:

Stored size: 947 Bytes

Contents

require 'spec_helper'
require 'seory/runtime'
require 'seory/page_contents'

describe Seory::Runtime do
  let(:seory) do
    Seory::Runtime.new(page_contents, controller)
  end

  let(:controller) { double('controller') }
  let(:page_contents) { Seory::PageContents.new(:default) }

  context 'static content' do
    before do
      page_contents.define(:title, 'A title')
      page_contents.define(:h1,    'Most importatnt HEADER 1')
    end

    describe '#title' do
      specify { expect(seory.title).to eq 'A title' }
    end

    describe '#h1' do
      specify { expect(seory.h1).to eq 'Most importatnt HEADER 1' }
    end
  end

  context 'controller based dynamic content' do
    before do
      allow(controller).to receive(:action_name) { 'edit' }

      page_contents.define(:title) { "#{action_name.upcase} | My Site" }
    end

    describe '#titie' do
      specify { expect(seory.title).to eq 'EDIT | My Site' }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
seory-0.0.2 spec/seory/runtime_spec.rb
seory-0.0.1 spec/seory/runtime_spec.rb