Sha256: a778a7b93d09ac3e3f1eadf47ecffbef16fe321ca0e4df5b21dffc6c00268a79

Contents?: true

Size: 773 Bytes

Versions: 1

Compression:

Stored size: 773 Bytes

Contents

require 'spec_helper'
require 'nokogiri'

describe Fdoc::BasePresenter do
  class Fdoc::SamplePresenter < Fdoc::BasePresenter
    def to_html
      render_erb('test.html.erb')
    end
  end

  subject {
    Fdoc::SamplePresenter.new :template_directory => 'templates'
  }

  context "#render_erb" do
    it "renders a default template" do
      File.should_receive(:exists?).with('templates/test.html.erb').and_return(false)
      File.stub(:read).and_return('test content')
      subject.to_html
    end

    it "renders from local template directory" do
      File.should_receive(:exists?).with('templates/test.html.erb').and_return(true)
      File.should_receive(:read).with('templates/test.html.erb').and_return('test content')
      subject.to_html
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fdoc-0.3.2 spec/fdoc/presenters/base_presenter_spec.rb