Permalink
Browse files

#css_code

  • Loading branch information...
1 parent 62844d7 commit cd4eb5a1b67a0fb29fae92f023aa9b11bc25a6f4 @chalmagean committed Dec 16, 2010
Showing with 22 additions and 0 deletions.
  1. +9 −0 lib/css_filter.rb
  2. +13 −0 spec/css_filter_spec.rb
View
9 lib/css_filter.rb
@@ -11,4 +11,13 @@ def css_dir
def css_files
Dir.glob("#{css_dir}/*.css")
end
+
+ def css_code
+ css_code = ""
+ css_files.each do |f|
+ css_code += File.read(f)
+ end
+
+ css_code
+ end
end
View
13 spec/css_filter_spec.rb
@@ -39,4 +39,17 @@
@css_filter.css_files.should be_nil
end
end
+end
+
+describe CSSFilter, "#css_code" do
+ before(:each) do
+ @css_filter = CSSFilter.new('/test')
+ end
+
+ it "should put all the css code together" do
+ @css_filter.should_receive(:css_files).and_return(['test1.css', 'test2.css'])
+ File.stub!(:read).with('test1.css').and_return("body1")
+ File.stub!(:read).with('test2.css').and_return("body2")
+ @css_filter.css_code.should eq("body1body2")
+ end
end

0 comments on commit cd4eb5a

Please sign in to comment.