Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

more stuff

  • Loading branch information...
commit 8ea79371607e646e886049f2d86cb43c9b6f3695 1 parent 7eaf5af
Cezar Halmagean authored
1  .rspec
... ... @@ -1 +1,2 @@
1 1 --color
  2 +--format documentation
28 Gemfile.lock
... ... @@ -0,0 +1,28 @@
  1 +GEM
  2 + remote: http://rubygems.org/
  3 + specs:
  4 + diff-lcs (1.1.2)
  5 + git (1.2.5)
  6 + jeweler (1.5.1)
  7 + bundler (~> 1.0.0)
  8 + git (>= 1.2.5)
  9 + rake
  10 + rake (0.8.7)
  11 + rcov (0.9.9)
  12 + rspec (2.1.0)
  13 + rspec-core (~> 2.1.0)
  14 + rspec-expectations (~> 2.1.0)
  15 + rspec-mocks (~> 2.1.0)
  16 + rspec-core (2.1.0)
  17 + rspec-expectations (2.1.0)
  18 + diff-lcs (~> 1.1.2)
  19 + rspec-mocks (2.1.0)
  20 +
  21 +PLATFORMS
  22 + ruby
  23 +
  24 +DEPENDENCIES
  25 + bundler (~> 1.0.0)
  26 + jeweler (~> 1.5.1)
  27 + rcov
  28 + rspec (~> 2.1.0)
4 Rakefile
@@ -15,8 +15,8 @@ Jeweler::Tasks.new do |gem|
15 15 gem.name = "css_filter"
16 16 gem.homepage = "http://github.com/mixandgo/css_filter"
17 17 gem.license = "MIT"
18   - gem.summary = %Q{TODO: one-line summary of your gem}
19   - gem.description = %Q{TODO: longer description of your gem}
  18 + gem.summary = %Q{Clean up dead css code}
  19 + gem.description = %Q{A little utility to clean up unused css from your rails project}
20 20 gem.email = "cezar@mixandgo.com"
21 21 gem.authors = ["Cezar Halmagean"]
22 22 # Include your dependencies below. Runtime dependencies are required when using your gem,
14 lib/css_filter.rb
... ... @@ -0,0 +1,14 @@
  1 +class CSSFilter
  2 +
  3 + def initialize(*args)
  4 + @css_dir = args.pop
  5 + end
  6 +
  7 + def css_dir
  8 + @css_dir
  9 + end
  10 +
  11 + def css_files
  12 + Dir.glob("#{css_dir}/*.css")
  13 + end
  14 +end
41 spec/css_filter_spec.rb
... ... @@ -1,7 +1,42 @@
1 1 require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2 2
3   -describe "CssFilter" do
4   - it "fails" do
5   - fail "hey buddy, you should probably rename this file and start specing for real"
  3 +describe CSSFilter, " when initialized" do
  4 + before(:each) do
  5 + @css_filter = mock(CSSFilter)
  6 + end
  7 +
  8 + context "with arguments" do
  9 + it "should store the css dir" do
  10 + CSSFilter.new("/test").css_dir.should_not be_nil
  11 + end
  12 + end
  13 +
  14 + context "with no arguments" do
  15 + it "should not store the css dir" do
  16 + CSSFilter.new.css_dir.should be_nil
  17 + end
6 18 end
7 19 end
  20 +
  21 +describe CSSFilter, "#css_files" do
  22 + before(:each) do
  23 + @css_filter = CSSFilter.new('/test')
  24 + end
  25 +
  26 + it "should recurse into subdirectories"
  27 +
  28 + context "if files exist" do
  29 + it "should return a list of css files" do
  30 + files = ['test1.css', 'test2.css']
  31 + Dir.stub!(:glob).with("/test/*.css").and_return(files)
  32 + @css_filter.css_files.should == files
  33 + end
  34 + end
  35 +
  36 + context "if no files exist" do
  37 + it "should return nil" do
  38 + Dir.stub!(:glob).with("/test/*.css").and_return(nil)
  39 + @css_filter.css_files.should be_nil
  40 + end
  41 + end
  42 +end

0 comments on commit 8ea7937

Please sign in to comment.
Something went wrong with that request. Please try again.