test/sassc_rails_test.rb in sassc-rails-1.1.0 vs test/sassc_rails_test.rb in sassc-rails-1.2.0
- old
+ new
@@ -20,11 +20,11 @@
# Not actually a default, but it makes assertions more complicated
@app.config.sass.line_comments = false
# Add a fake compressor for testing purposes
- @app.assets.register_compressor "text/css", :test, TestCompressor
+ Sprockets.register_compressor "text/css", :test, TestCompressor
Rails.backtrace_cleaner.remove_silencers!
end
def teardown
@@ -37,32 +37,22 @@
end
def initialize!
Rails.env = "test"
@app.initialize!
- handle_sass_rails
end
def initialize_dev!
Rails.env = "development"
@app.initialize!
- handle_sass_rails
end
def initialize_prod!
Rails.env = "production"
@app.initialize!
- handle_sass_rails
end
- def handle_sass_rails
- if defined?(Sass::Rails)
- Rails.application.assets.register_engine '.sass', SassC::Rails::SassTemplate
- Rails.application.assets.register_engine '.scss', SassC::Rails::ScssTemplate
- end
- end
-
def test_setup_works
initialize_dev!
asset = render_asset("application.scss")
@@ -228,15 +218,16 @@
.hello{color:#FFF}
CSS
end
def test_sassc_compression_is_used
- initialize_prod!
-
engine = stub(render: "")
SassC::Engine.expects(:new).returns(engine)
SassC::Engine.expects(:new).with("", {style: :compressed}).returns(engine)
+
+ initialize_prod!
+
render_asset("application.scss")
end
def test_allows_for_inclusion_of_inline_source_maps
@app.config.sass.inline_source_maps = true
@@ -320,7 +311,9 @@
ensure
File.delete(new_file)
end
end
- class TestCompressor; end
+ class TestCompressor
+ def self.call(*); end
+ end
end