package org.example.javasass;

import static org.junit.Assert.assertEquals;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.SimpleBindings;

import org.junit.Test;

public class JavaSassTest {

	@Test
	public void testJavaSass() throws Exception {

		ScriptEngineManager manager = new ScriptEngineManager();
		ScriptEngine engine = manager.getEngineByName("jruby");
		engine.eval("require 'rubygems'; require 'sass';");

		String sass = ".test\n\tcolor: red";

		SimpleBindings bindings = new SimpleBindings();
		bindings.put("str", sass);
		String css = (String) engine.eval("Sass::Engine.new($str).render", bindings);

		assertEquals(".test {\n  color: red; }\n", css);
	}

}

@@ -81,110 +81,42 @@
 ort 
-javax.script.ScriptEngine;%0Aimport javax.script.ScriptEngineManager;%0Aimport javax.script.SimpleBindings
+org.jruby.embed.ScriptingContainer
 ;%0A%0Ai
@@ -171,16 +171,22 @@
  %7B%0A%0A
-%09
+    
 @Test%0A
-%09
+    
 publ
@@ -231,36 +231,42 @@
 n %7B%0A
-%0A%09%09
+        
 Script
-EngineManager manag
+ingContainer contain
 er =
@@ -280,96 +280,54 @@
 ript
-EngineManager();%0A%09%09ScriptEngine engine = manager.getEngineByName(%22jruby%22);%0A%09%09engine.eval
+ingContainer();%0A        container.runScriptlet
 (%22re
@@ -364,18 +364,24 @@
 s';%22);%0A%0A
-%09%09
+        
 String s
@@ -413,69 +413,25 @@
 d%22;%0A
-%0A%09%09SimpleBindings bindings = new SimpleBindings();%0A%09%09bindings
+        container
 .put
@@ -445,18 +445,33 @@
  sass);%0A
-%09%09
+        %0A        
 String c
@@ -487,20 +487,30 @@
 ing)
- engine.eval
+container.runScriptlet
 (%22Sa
@@ -528,9 +528,8 @@
 new(
-$
 str)
@@ -540,24 +540,20 @@
 der%22
-, bindings);%0A%0A%09%09
+);%0A%0A        
 asse
@@ -601,9 +601,12 @@
 s);%0A
-%09
+    
 %7D%0A%0A%7D

Fix integration test failure.