Permalink
Browse files

Render _sections for non-html templates. Fixes #11

  • Loading branch information...
1 parent f6a37c3 commit edfdae21f83c2f02da7c11b8f986e43d187583d7 @wagenet wagenet committed Oct 22, 2011
Showing with 7 additions and 2 deletions.
  1. +1 −1 lib/guides/generator.rb
  2. +6 −1 spec/build_spec.rb
@@ -141,10 +141,10 @@ def generate_guide(guide, output_file)
File.open(File.join(output_dir, output_file), 'w') do |f|
view = ActionView::Base.new(source_dir, :edge => edge, :production => @production)
view.extend(Helpers)
+ view.render("sections")
if guide =~ /\.html\.erb$/
# Generate the special pages like the home.
- view.render("sections")
type = @edge ? "edge" : "normal"
result = view.render(:layout => 'layout', :file => guide, :locals => {:guide_type => type})
else
View
@@ -40,7 +40,10 @@
end
it "creates index.html" do
- File.read("output/index.html").should =~ /<a href="article_one.html">/
+ index = File.read("output/index.html")
+ index.should =~ /<a href="article_one.html">/
+ # Test _sections.html.erb with .html.erb templates
+ index.should =~ /This work is licensed under/
end
it "should not show under-construction articles in index" do
@@ -50,6 +53,8 @@
it "creates contribute.html" do
contribute = File.read("output/contribute.html")
contribute.should =~ /<h2>Contribute<\/h2>/
+ # Test _sections.html.erb with .textile templates
+ contribute.should =~ /This work is licensed under/
end
it "creates normal article" do

0 comments on commit edfdae2

Please sign in to comment.