Testing Font Source Declaration Utilities in Bourbon Framework
This test suite validates the font-source-declaration utility in Bourbon, focusing on proper font URL generation with and without asset pipeline integration. It ensures correct formatting of font source declarations for different file formats and pipeline configurations.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
thoughtbot/bourbon
spec/bourbon/utilities/font_source_declaration_spec.rb
require "spec_helper"
describe "font-source-declaration" do
before(:all) do
ParserSupport.parse_file("utilities/font-source-declaration")
end
context "called with pipeline" do
it "returns pipeline path" do
rule = 'src: font-url("b.woff2") format("woff2"), ' +
'font-url("b.woff") format("woff")'
expect(".has-pipeline").to have_rule(rule)
end
end
context "called with no pipeline" do
it "does not return pipeline path" do
rule = 'src: url("b.woff2") format("woff2"), ' +
'url("b.woff") format("woff")'
expect(".no-pipeline").to have_rule(rule)
end
end
end