font-awesome-propshaft 1.0.2 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,28 @@
1
1
  require 'test_helper'
2
2
  require "propshaft/asset"
3
3
  require "propshaft/load_path"
4
+ require "open3"
4
5
 
5
6
  class FontAwesomePropshaftRailsTest < ActionDispatch::IntegrationTest
6
7
 
8
+ setup do
9
+ @project_root = File.expand_path("..", __dir__)
10
+
11
+ @app_styles = File.join(@project_root, "app", "assets", "stylesheets")
12
+ @dummy_styles = File.join(@project_root, "test", "dummy", "app", "assets", "stylesheets")
13
+ @builds_dir = File.join(@project_root, "test", "dummy", "app", "assets", "builds")
14
+
15
+ FileUtils.mkdir_p(@builds_dir)
16
+ end
17
+
18
+ teardown do
19
+ if Dir.exist?(@builds_dir)
20
+ Dir.glob(File.join(@builds_dir, "*")).each do |file|
21
+ FileUtils.rm_rf(file)
22
+ end
23
+ end
24
+ end
25
+
7
26
  test "engine is loaded" do
8
27
  assert_equal ::Rails::Engine, FontAwesomePropshaft::Rails::Engine.superclass
9
28
  end
@@ -50,38 +69,45 @@ class FontAwesomePropshaftRailsTest < ActionDispatch::IntegrationTest
50
69
  assert_match(/font-family:\s*'FontAwesome';/, css)
51
70
  end
52
71
 
53
- test "sass import compiles correctly" do
54
- asset = Rails.application.assets.load_path.find("sass-import.css.sass")
55
- assert asset, "sass-import.css.sass not found in Propshaft load path"
56
-
57
- source = File.read(asset.path)
58
- engine = SassC::Engine.new(
59
- source,
60
- syntax: :sass,
61
- load_paths: Rails.application.config.assets.paths
62
- )
63
-
64
- css = engine.render
65
- assert_match(/font-family:\s*'FontAwesome';/, css, "sass-import.css.sass missing FontAwesome styles")
66
- rescue SassC::SyntaxError => e
67
- flunk "sass-import.css.sass failed to compile: #{e.message}"
68
- end
72
+ test "SASS and SCSS imports compile correctly with DartSass" do
73
+ {
74
+ "sass-import.css.sass" => "sass-import.css",
75
+ "scss-import.css.scss" => "scss-import.css"
76
+ }.each do |src_file, out_file|
77
+ source = File.join(@dummy_styles, src_file)
78
+ output = File.join(@builds_dir, out_file)
69
79
 
70
- test "scss import compiles correctly" do
71
- asset = Rails.application.assets.load_path.find("scss-import.css.scss")
72
- assert asset, "scss-import.css.scss not found in Propshaft load path"
73
-
74
- source = File.read(asset.path)
75
- engine = SassC::Engine.new(
76
- source,
77
- syntax: :scss,
78
- load_paths: Rails.application.config.assets.paths
79
- )
80
-
81
- css = engine.render
82
- assert_match(/font-family:\s*'FontAwesome';/, css, "scss-import.css.scss missing FontAwesome styles")
83
- rescue SassC::SyntaxError => e
84
- flunk "scss-import.css.scss failed to compile: #{e.message}"
80
+ cmd = [
81
+ "bundle", "exec", "dartsass",
82
+ "#{source}:#{output}",
83
+ "--load-path", @app_styles,
84
+ "--load-path", @dummy_styles
85
+ ]
86
+
87
+ stdout, stderr, status = nil
88
+ Dir.chdir(@project_root) do
89
+ stdout, stderr, status = Open3.capture3(*cmd)
90
+ end
91
+
92
+ unless status.success?
93
+ message = <<~MSG
94
+ DartSass compilation failed for #{src_file}
95
+ Exit status: #{status && status.exitstatus}
96
+ Command: #{cmd.join(" ")}
97
+ STDOUT:
98
+ #{stdout.to_s.strip.empty? ? "(empty)" : stdout}
99
+ STDERR:
100
+ #{stderr.to_s.strip.empty? ? "(empty)" : stderr}
101
+ MSG
102
+
103
+ flunk message
104
+ end
105
+
106
+ assert File.exist?(output), "Compiled #{out_file} not found at #{output}"
107
+
108
+ css = File.read(output)
109
+ assert_match(/font-family:\s*["']?FontAwesome["']?;/, css, "FontAwesome styles missing or formatted differently in #{out_file}")
110
+ end
85
111
  end
86
112
 
87
113
  test "helpers should be available in the view" do
data/test/test_helper.rb CHANGED
@@ -3,5 +3,6 @@ ENV["RAILS_ENV"] = "test"
3
3
 
4
4
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
5
  require "rails/test_help"
6
+ require "dartsass-rails"
6
7
 
7
8
  Rails.backtrace_cleaner.remove_silencers!
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: font-awesome-propshaft
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - greenslonik10
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-10-06 00:00:00.000000000 Z
10
+ date: 2025-10-07 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: railties
@@ -50,33 +50,39 @@ dependencies:
50
50
  - !ruby/object:Gem::Version
51
51
  version: '2.0'
52
52
  - !ruby/object:Gem::Dependency
53
- name: sassc
53
+ name: dartsass-rails
54
54
  requirement: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - "~>"
56
+ - - ">="
57
57
  - !ruby/object:Gem::Version
58
- version: '2.4'
58
+ version: 0.4.0
59
+ - - "<"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
59
62
  type: :runtime
60
63
  prerelease: false
61
64
  version_requirements: !ruby/object:Gem::Requirement
62
65
  requirements:
63
- - - "~>"
66
+ - - ">="
64
67
  - !ruby/object:Gem::Version
65
- version: '2.4'
68
+ version: 0.4.0
69
+ - - "<"
70
+ - !ruby/object:Gem::Version
71
+ version: '2.0'
66
72
  - !ruby/object:Gem::Dependency
67
73
  name: activesupport
68
74
  requirement: !ruby/object:Gem::Requirement
69
75
  requirements:
70
76
  - - "~>"
71
77
  - !ruby/object:Gem::Version
72
- version: '8.1'
78
+ version: '8.0'
73
79
  type: :development
74
80
  prerelease: false
75
81
  version_requirements: !ruby/object:Gem::Requirement
76
82
  requirements:
77
83
  - - "~>"
78
84
  - !ruby/object:Gem::Version
79
- version: '8.1'
85
+ version: '8.0'
80
86
  description: font-awesome-propshaft provides the Font-Awesome web fonts and stylesheets
81
87
  as a Rails engine for use with the asset pipeline.
82
88
  email: