mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 05:33:38 +08:00
4ea21fa2d0
This change both speeds up specs (less strings to allocate) and helps catch cases where methods in Discourse are mutating inputs. Overall we will be migrating everything to use #frozen_string_literal: true it will take a while, but this is the first and safest move in this direction
32 lines
970 B
Ruby
32 lines
970 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
require 'stylesheet/compiler'
|
|
|
|
describe Stylesheet::Compiler do
|
|
describe 'compilation' do
|
|
Dir["#{Rails.root.join("app/assets/stylesheets")}/*.scss"].each do |path|
|
|
path = File.basename(path, '.scss')
|
|
|
|
it "can compile '#{path}' css" do
|
|
css, _map = Stylesheet::Compiler.compile_asset(path)
|
|
expect(css.length).to be > 1000
|
|
end
|
|
end
|
|
end
|
|
|
|
it "supports asset-url" do
|
|
css, _map = Stylesheet::Compiler.compile(".body{background-image: asset-url('/images/favicons/github.png');}", "test.scss")
|
|
|
|
expect(css).to include("url('/images/favicons/github.png')")
|
|
expect(css).not_to include('asset-url')
|
|
end
|
|
|
|
it "supports image-url" do
|
|
css, _map = Stylesheet::Compiler.compile(".body{background-image: image-url('/favicons/github.png');}", "test.scss")
|
|
|
|
expect(css).to include("url('/favicons/github.png')")
|
|
expect(css).not_to include('image-url')
|
|
end
|
|
end
|