rails-assets/rails-assets — pull request #182 by pablobm (2014-09-27 21:20:09+00:00)
Title: Spaces around the URL & within the braces are OK

### What?

On CSS files, asset links were not converted correctly if there was an space before or after the URL, but inside the braces. For example, in the package "building-blocks", the following line:

background: url( buttons/images/ui/shadow.png) repeat-x left bottom / auto 100%;

Was being converted to:

background: image-url(".") repeat-x left bottom / auto 100%;

### How?

The culprit was the regular expression that parses those links, found in `Build::Transformer#process_asset`. Changing it to allow for spaces within the braces, around the URL, solved the problem.

### Specs?

I was first able to reproduce this on the specs by adding a check on `spec/models/builder_spec.rb`. From there, I isolated the problem and added a unit test on `spec/models/build/transformer_spec.rb` before fixing the code.

### Improvements?

The regular expression is complex enough to deserve more focused unit tests. Perhaps moving the code in `#process_asset` to a separate class that can be tested on its own.

### One more thing...
Should this pull request be accepted&merged, could you please rebuild the gem `rails-assets-building-blocks` after deployment? 0:-)

Thank you!