Sha256: d81e56a3b9b2070f4a4dd29cac5c2547ba6d2e744379861c2eabd4d3c9412b1e

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

# -*- encoding: utf-8 -*-

require './spec/helper'

describe PageCompiler do

  after :all do
    clean_test_repository
  end
  
  def create_sample_project
    FileUtils.makedirs('spec/project-name/templates')
    FileUtils.makedirs('spec/project-name/pages')
    File.open('spec/project-name/templates/main.html', "w") {|out| out.puts '<h1><genit var="title"/></h1>' }
    File.open('spec/project-name/pages/index.html', "w") {|out| out.puts '<genit var="title">My Title</genit>' }
  end
  
  it "should substitute a variable" do
    create_sample_project
    pc = PageCompiler.new 'spec/project-name/', 'index.html'
    doc = pc.compile
    
    doc.at_css('h1').inner_html.should == 'My Title'
  end
  
  it "should not delete the tag from page when a var is subsituted" do
    create_sample_project
    pc = PageCompiler.new 'spec/project-name/', 'index.html'
    doc = pc.compile
    
    page = IO.read 'spec/project-name/pages/index.html'
    page.match('<genit var="title">My Title</genit>').should_not == nil
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
genit-0.5 spec/page_compiler_spec.rb