Skip to content

Commit 7e9707b

Browse files
committed
improve tests
1 parent 7175227 commit 7e9707b

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

lib/sassc/rails/compressor.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
class Sprockets::SassCompressor
44
def call(*args)
55
input = if defined?(data)
6-
data
6+
data # sprockets 2.x
77
else
8-
args[0][:data]
8+
args[0][:data] #sprockets 3.x
99
end
1010

1111
SassC::Engine.new(
@@ -15,5 +15,7 @@ def call(*args)
1515
}
1616
).render
1717
end
18+
19+
# sprockets 2.x
1820
alias :evaluate :call
1921
end

test/sassc_rails_test.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,23 @@ def test_compression_works
204204
CSS
205205
end
206206

207+
def test_compression_works
208+
initialize_prod!
209+
210+
asset = render_asset("application.scss")
211+
assert_equal <<-CSS, asset
212+
.hello{color:#FFF}
213+
CSS
214+
end
215+
216+
def test_sassc_compression_is_used
217+
initialize_prod!
218+
219+
engine = stub(render: "")
220+
SassC::Engine.expects(:new).returns(engine)
221+
SassC::Engine.expects(:new).with("", {style: :compressed}).returns(engine)
222+
render_asset("application.scss")
223+
end
207224
#test 'sprockets require works correctly' do
208225
# skip
209226

0 commit comments

Comments
 (0)