Sha256: c0fb062959ee6977249fc0095cc8f56fd47621cb1b13c12dbb7ab31e8bd5aa5d
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 KB
Contents
# -*- encoding: utf-8 -*- require './spec/helper' describe PagesFinder do before :each do @project = ProjectCreator.new('spec/project-name', false, false) @project.create @finder = PagesFinder.new 'spec/project-name' end after :each do clean_test_repository end def write_file name, content File.open(File.join('spec/project-name', name), "w") do |file| file.puts content end end it "should retrieve the right number of pages" do write_file 'src/pages/a.html', '<h1>a</h1>' write_file 'src/pages/b.html', '<h1>b</h1>' @finder.find.size.should == 3 end it "should name the pages from the root" do write_file 'src/pages/a.html', '<h1>a</h1>' write_file 'src/pages/b.html', '<h1>b</h1>' list = @finder.find list.include?("index.html").should be_true list.include?("a.html").should be_true list.include?("b.html").should be_true end it "should take care of markdown files" do write_file 'src/pages/a.markdown', '#a' write_file 'src/pages/b.markdown', '#b' list = @finder.find list.size.should == 3 list.include?("index.html").should be_true list.include?("a.html").should be_true list.include?("b.html").should be_true end it "should transform an array of pagenames into an array of URL strings" do pagenames = ['a.html', 'b.html', 'c/d.html'] url = 'http://www.example.com' result = PagesFinder.pagenames2urls(pagenames, url) result.size.should == 3 result.include?('http://www.example.com/a.html').should be_true result.include?('http://www.example.com/b.html').should be_true result.include?('http://www.example.com/c/d.html').should be_true end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
genit-2.1 | spec/pages_finder_spec.rb |