Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Specs

  • Loading branch information...
commit cfc985d43467411a48ae3ccff4b3d7b6e986e8b4 1 parent c9e0d6c
@carlhoerberg authored
View
5 Rakefile
@@ -1 +1,6 @@
require "bundler/gem_tasks"
+require 'rake/testtask'
+
+Rake::TestTask.new do |t|
+ t.pattern = "spec/*_spec.rb"
+end
View
5 lib/sprockets-urlrewriter.rb
@@ -1,5 +1,4 @@
-require "sprockets-urlrewriter/version"
-
+require_relative 'sprockets-urlrewriter/version'
require 'sprockets'
require 'pathname'
require 'uri'
@@ -15,4 +14,4 @@ def evaluate(context, locals)
end
end
end
-end
+end
View
17 spec/urlrewriter_spec.rb
@@ -0,0 +1,17 @@
+require 'minitest/autorun'
+require './lib/sprockets-urlrewriter'
+
+describe 'UrlRewriter' do
+ class FakeContext
+ attr_accessor :logical_path
+ end
+
+ it 'finds relatives urls and makes them absolut' do
+ ctx = FakeContext.new
+ ctx.logical_path = "/assets/css/jada.css"
+ css = "body { background-url: url('bg.jpg?1232') }"
+ ur = Sprockets::UrlRewriter.new { css }
+ result = ur.evaluate ctx, {}
+ assert_equal "body { background-url: url(/assets/css/bg.jpg) }", result
+ end
+end
View
11 sprockets-urlrewriter.gemspec
@@ -7,9 +7,9 @@ Gem::Specification.new do |s|
s.version = Sprockets::Urlrewriter::VERSION
s.authors = ["Carl Hörberg"]
s.email = ["carl.hoerberg@gmail.com"]
- s.homepage = ""
- s.summary = %q{TODO: Write a gem summary}
- s.description = %q{TODO: Write a gem description}
+ s.homepage = "http://github.com/carlhoerberg/sprockets-urlrewriter"
+ s.summary = %q{Makes absolut urls in CSS files generated by Sprockets}
+ s.description = %q{ Replaces all instances of url() in CSS files Sprockets concats, if the url is relative. }
s.rubyforge_project = "sprockets-urlrewriter"
@@ -18,7 +18,6 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- # specify any dependencies here; for example:
- # s.add_development_dependency "rspec"
- # s.add_runtime_dependency "rest-client"
+ s.add_development_dependency "minitest"
+ s.add_runtime_dependency "sprockets"
end

0 comments on commit cfc985d

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