Sha256: fec41ce074ec4fd9ef6a59fed3fc60835eafdf8494e70259d87e77a0443fb8a6

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 KB

Contents

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

require './spec/helper'

describe Fragment do

  it "should replace one fragment tag" do
    fragment = Fragment.new("spec/test-files/fragment.html", 'spec/test-files')
    fragment.to_html.start_with?('<h1>title</h1>').should be_true
  end
  
  it "should replace one fragment tag among other tags" do
    fragment = Fragment.new("spec/test-files/fragment4.html", 'spec/test-files')
    result = fragment.to_html
    result.gsub!("\n", '')
    result.should == '<h1>title</h1><p>para</p><p>footer</p>'
  end
  
  it "should replace one fragment tag in markdown" do
    fragment = Fragment.new("spec/test-files/fragment3.html", 'spec/test-files')
    fragment.to_html.start_with?('<h1>title</h1>').should be_true
  end
  
  it "should replace some fragment tags" do
    fragment = Fragment.new("spec/test-files/fragment2.html", 'spec/test-files')
    result = fragment.to_html.gsub("\n", '')
    result.should == ("<p>abcde</p>")
  end

  it "should not change a file without fragment tag" do
    fragment = Fragment.new("spec/test-files/nothing.html", 'spec/test-files')
    fragment.to_html.start_with?("<h1>title</h1>").should be_true
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
genit-2.1 spec/fragment_spec.rb
genit-1.0.1 spec/fragment_spec.rb
genit-1.0 spec/fragment_spec.rb
genit-0.99 spec/fragment_spec.rb
genit-0.9 spec/fragment_spec.rb
genit-0.5 spec/fragment_spec.rb
genit-0.4.1 spec/fragment_spec.rb
genit-0.4 spec/fragment_spec.rb
genit-0.3 spec/fragment_spec.rb