Sha256: 244de3ab4da195f31fc4c37b883e56b421c932be3ee77fc6fe8605fb8af721e4

Contents?: true

Size: 1.48 KB

Versions: 7

Compression:

Stored size: 1.48 KB

Contents

require 'test_helper'

context "Stylesheet minifier" do
  setup { Smurf::Stylesheet }
  helper(:minify) { |content| topic.new(content).minified }

  should "want to minify files in the stylesheets directory" do
    topic.minifies?(["a/b/stylesheets/bar.css", "c/d/stylesheets/baz.css?12344"])
  end

  should "want to minify files in the javascripts directory" do
    topic.minifies?(["a/b/javascripts/bar.css?12345", "c/d/javascripts/baz.css"])
  end

  should "want to minify nothing but javascripts" do
    topic.minifies?(["a/b/stylesheet/foo.js", "c/d/javascripts/baz.js"])
  end.not!

  context "minifying a non-existent pattern in a stylesheet" do
    should("succeed for removing comments") do
      minify("hi {  mom:  super-awesome; } ")
    end.equals("hi{mom:super-awesome}")

    should("succeed when no spaces to compress") do
      minify("hi{mom:super-awesome}")
    end.equals("hi{mom:super-awesome}")

    # nothing outside, means nothing inside. they are complementary
    should "succeed when no outside or inside blocks" do
      minify("how-did:  this-happen;  typo: maybe;}")
    end.equals("how-did: this-happen; typo: maybe}")

    asserts "when no last semi-colon in block" do
      minify("hi {  mom:  super-awesome } ")
    end.equals("hi{mom:super-awesome}")

    asserts("empty string when no content provided") { minify("") }.equals("")

    asserts("nil even if nil provided") { minify(nil) }.nil
  end # minifying a non-existent pattern in a stylesheet
end # Stylesheet minifier

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
ps-smurf-1.2.0 test/stylesheet_test.rb
smurf-1.0.8 test/stylesheet_test.rb
smurf-1.0.7 test/stylesheet_test.rb
smurf-1.0.6 test/stylesheet_test.rb
smurf-1.0.5 test/stylesheet_test.rb
smurf-1.0.4.rails3.beta3 test/stylesheet_test.rb
smurf-1.0.4.rails3.beta2 test/stylesheet_test.rb