<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -10,13 +10,11 @@ module Headerize
     def javascript_includes(opts = {})
       return '' if @javascripts.nil?
 
-      indent_amt = opts[:indent] || 4
-
       includes = @javascripts.inject('') do |str, files_and_opts|
         str &lt;&lt; javascript_include_tag(*files_and_opts)
       end
 
-      indent(includes, indent_amt)
+      indent(includes, opts[:indent] || 4)
     end
 
     private</diff>
      <filename>lib/headerize/javascript_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,28 @@
 module Headerize
   module StylesheetHelper
+    def add_stylesheet(*args)
+      @stylesheets ||= []
+      @stylesheets &lt;&lt; args
+
+      nil
+    end
+
+    def stylesheet_links(opts = {})
+      return '' if @stylesheets.nil?
+
+      links = @stylesheets.inject('') do |str, files_and_opts|
+        str &lt;&lt; stylesheet_link_tag(*files_and_opts)
+      end
+
+      indent(links, opts[:indent] || 4)
+    end
+
+    private
+      # Indents the given string by the given amount. Does not indent the first
+      # line.
+      def indent(string, amt)
+        string.gsub /\n *([^\n]+)/m, &quot;\n#{' ' * amt}\\1&quot;
+      end
   end
 end
 </diff>
      <filename>lib/headerize/stylesheet_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -115,11 +115,11 @@ describe JavascriptHelper, 'when outputting with indentation and one item' do
   end
 
   it 'should not indent the first line' do
-    javascript_includes(:indent =&gt; 8).should == &quot;test\n&quot;
+    javascript_includes(:indent =&gt; 8).should =~ /^test/
   end
 
   it 'should not indent newlines with no text after them' do
-    javascript_includes(:indent =&gt; 8).should == &quot;test\n&quot;
+    javascript_includes(:indent =&gt; 8).should =~ /\n$/m
   end
 end
 
@@ -139,3 +139,16 @@ describe JavascriptHelper, 'when outputting with indentation and one item' do
   end
 end
 
+describe JavascriptHelper, 'when outputting multiple scripts ' +
+    'with no explicit indentation' do
+  before(:each) do
+    self.stub!(:javascript_include_tag).and_return(&quot;test\npower\n&quot;)
+
+    add_javascript 'test', 'power'
+  end
+
+  it 'should indent with 4 spaces' do
+    javascript_includes.should =~ /^ {4}power$/
+  end
+end
+</diff>
      <filename>spec/headerize/javascript_helper_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,6 +3,154 @@ require File.dirname(__FILE__) + '/../../lib/headerize/stylesheet_helper.rb'
 
 include Headerize
 
-describe StylesheetHelper do
+describe StylesheetHelper, 'when including a single file' do
+  it 'should reutrn nothing' do
+    add_stylesheet('test').should be_nil
+  end
+end
+
+describe StylesheetHelper, 'when including multiple files' do
+  it 'should return nothing' do
+    add_stylesheet('test', 'second_test', 'magic').should be_nil
+  end
+end
+
+describe StylesheetHelper, 'when passing extra arguments to add_stylesheet' do
+  it 'should return nothing' do
+    add_stylesheet('test', 'magic', :media =&gt; 'print').should be_nil
+  end
+end
+
+describe StylesheetHelper, 'when outputting stylesheets without files' do
+  it 'should return an empty string' do
+    stylesheet_links.should be_empty
+  end
+end
+
+describe StylesheetHelper, 'when outputting with indentation ' +
+    'but no stylesheets' do
+  it 'should return an empty string' do
+    stylesheet_links(:indent =&gt; 8).should be_empty
+  end
+end
+
+describe StylesheetHelper, 'when outputting stylesheets with a single file' do
+  before(:each) do
+    add_stylesheet 'test'
+  end
+
+  it 'should use stylesheet_link_tag to include it' do
+    self.should_receive(:stylesheet_link_tag).with('test').and_return('test')
+
+    stylesheet_links.should == 'test'
+  end
+end
+
+describe StylesheetHelper,
+    'when outputting stylesheets with multiple add_stylesheet arguments' do
+  before(:each) do
+    add_stylesheet 'test', 'magic', :media =&gt; 'print'
+  end
+
+  it 'should splat the arguments to the stylesheet_link_tag' do
+    self.should_receive(:stylesheet_link_tag) \
+        .with('test', 'magic', :media =&gt; 'print').and_return('test')
+
+    stylesheet_links.should == 'test'
+  end
+end
+
+describe StylesheetHelper,
+    'when outputting stylesheets through multiple invocations' do
+  before(:each) do
+    add_stylesheet 'test'
+    add_stylesheet 'test2', 'magic'
+    add_stylesheet 'power'
+  end
+
+  it 'should call stylesheet_link_tag for each set ' +
+     'and concatenate the results' do
+    self.should_receive(:stylesheet_link_tag) \
+        .with('test').and_return('test')
+    self.should_receive(:stylesheet_link_tag) \
+        .with('test2', 'magic').and_return('test2')
+    self.should_receive(:stylesheet_link_tag) \
+        .with('power').and_return('test3')
+
+    links = stylesheet_links
+    links.should =~ /^test/
+    links.should =~ /test2/
+    links.should =~ /test3$/
+  end
+end
+
+describe StylesheetHelper,
+    'when outputting stylesheets through multiple invocations ' +
+    'with extra arguments' do
+  before(:each) do
+    add_stylesheet 'test', :media =&gt; 'print'
+    add_stylesheet 'test2', 'magic', :media =&gt; 'print'
+    add_stylesheet 'power', :cache =&gt; true
+  end
+
+  it 'should splat the arguments to stylesheet_link_tag each time ' +
+     'and concatenate the results' do
+    self.should_receive(:stylesheet_link_tag) \
+        .with('test', :media =&gt; 'print').and_return('test')
+    self.should_receive(:stylesheet_link_tag) \
+        .with('test2', 'magic', :media =&gt; 'print').and_return('test2')
+    self.should_receive(:stylesheet_link_tag) \
+        .with('power', :cache =&gt; true).and_return('test3')
+
+    links = stylesheet_links
+    links.should =~ /^test/
+    links.should =~ /test2/
+    links.should =~ /test3$/
+  end
+end
+
+describe StylesheetHelper, 'when outputting with indentation and one item' do
+  before(:each) do
+    self.stub!(:stylesheet_link_tag).and_return(&quot;test\n&quot;)
+
+    add_stylesheet 'test'
+  end
+
+  it 'should not indent the first line' do
+    stylesheet_links(:indent =&gt; 8).should =~ /^test/
+  end
+
+  it 'should not indent newlines with no text after them' do
+    stylesheet_links(:indent =&gt; 8).should =~ /\n$/m
+  end
+end
+
+describe StylesheetHelper, 'when outputting with indentation and one item' do
+  before(:each) do
+    self.stub!(:stylesheet_link_tag).and_return(&quot;test\npower\n&quot;)
+
+    add_stylesheet 'test', 'power'
+  end
+
+  it 'should not indent the first line' do
+    stylesheet_links(:indent =&gt; 8).should =~ /^test$/
+  end
+
+  it 'should indent newlines with text after them' do
+    stylesheet_links(:indent =&gt; 8).should =~ /^ {8}power$/
+  end
+end
+
+describe StylesheetHelper, 'when outputting multiple stylesheets ' +
+    'with no explicit indentation' do
+  before(:each) do
+    self.stub!(:stylesheet_link_tag).and_return(&quot;test\npower\n&quot;)
+
+    add_stylesheet 'test', 'power'
+  end
+
+  it 'should indent with 4 spaces' do
+    stylesheet_links.should =~ /^ {4}power$/
+  end
 end
 </diff>
      <filename>spec/headerize/stylesheet_helper_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3b6677869333e3bcc257f00602af7b2981b067bc</id>
    </parent>
  </parents>
  <author>
    <name>shadowfiend</name>
    <email>shadowfiend@ubuntu.Belkin</email>
  </author>
  <url>http://github.com/Shadowfiend/headerize/commit/491e068f573954116ba8b83d021d7160ff3680ac</url>
  <id>491e068f573954116ba8b83d021d7160ff3680ac</id>
  <committed-date>2008-06-07T17:01:25-07:00</committed-date>
  <authored-date>2008-06-07T17:01:25-07:00</authored-date>
  <message>Added StylesheetHelper specs and code, made some reforms to the specs and code
for JavascriptHelper along the way.</message>
  <tree>b13503dfefe78b08d8af06992a2efafea76643dc</tree>
  <committer>
    <name>shadowfiend</name>
    <email>shadowfiend@ubuntu.Belkin</email>
  </committer>
</commit>
