Sha256: 666ca97153d687739c80438982c9b9e13c17ad6c77e20e044c1fb4c025cedf3f
Contents?: true
Size: 1.94 KB
Versions: 1
Compression:
Stored size: 1.94 KB
Contents
require 'spec_helper' describe Rwiki::Utils::TextileHelper do include Rwiki::Utils subject { TextileHelper.new(content) } context "with a sample content" do let(:content) { "h1. This is a sample content" } its(:content) { should == "h1. This is a sample content" } its(:parsed_content) { should == %Q{<h1><a name="This-is-a-sample-content">This is a sample content</a></h1>} } its(:textile_toc) { should == '# "This is a sample content":#This-is-a-sample-content' } end context "with a complex content" do let(:content) do <<-CONTENT h1. This is the page title Lorem ipsum.. h2. Section 1 h3. Section 1.1 ..dolor etc. h3. Section 1.2 h3. Section 1.3 h4. Section 1.3.1 h2. Section 2 h3. Yet another section CONTENT end describe "#parsed_content" do let(:result) { subject.parsed_content } it "should generate html with page content" do result.should_not be_nil result.should include('<h1><a name="This-is-the-page-title">This is the page title</a></h1>') result.should include('Lorem ipsum..') result.should include('<h3><a name="Yet-another-section">Yet another section</a></h3>') end it "should not change the original content" do subject.content.should == content end end describe "#textile_toc" do it "should generate a textile code with the Table Of Content" do expected_toc = <<-TOC.gsub(/^\s*/, '').strip # "This is the page title":#This-is-the-page-title ## "Section 1":#Section-1 ### "Section 1.1":#Section-1.1 ### "Section 1.2":#Section-1.2 ### "Section 1.3":#Section-1.3 #### "Section 1.3.1":#Section-1.3.1 ## "Section 2":#Section-2 ### "Yet another section":#Yet-another-section TOC subject.textile_toc.should == expected_toc end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rwiki-0.2.5 | spec/rwiki/utils/textile_helper_spec.rb |