Skip to content

Commit

Permalink
Test refactor and upgrade to grooscript 0.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
chiquitinxx committed Oct 24, 2013
1 parent dcf0854 commit c596c2b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 36 deletions.
5 changes: 3 additions & 2 deletions grails-app/conf/BuildConfig.groovy
Expand Up @@ -15,8 +15,9 @@ grails.project.dependency.resolution = {

dependencies {
compile 'org.vert-x:vertx-lang-groovy:1.3.1.final'
compile 'org.codehaus.gpars:gpars:1.0.0'
compile ('org.grooscript:grooscript:0.3.2') {
compile 'org.codehaus.jsr166-mirror:jsr166y:1.7.0'
compile 'org.codehaus.gpars:gpars:1.1.0'
compile ('org.grooscript:grooscript:0.3.4') {
exclude 'groovy'
}
test "org.spockframework:spock-grails-support:0.7-groovy-2.0"
Expand Down
22 changes: 0 additions & 22 deletions src/groovy/org/grooscript/grails/plugin/PhantomJsCase.groovy

This file was deleted.

39 changes: 39 additions & 0 deletions src/groovy/org/grooscript/grails/plugin/test/PhantomJsCase.groovy
@@ -0,0 +1,39 @@
package org.grooscript.grails.plugin.test

import org.codehaus.groovy.grails.web.mapping.LinkGenerator
import org.grooscript.GsConverter
import org.grooscript.asts.PhantomJsTestImpl
import org.springframework.beans.factory.annotation.Autowired
import static org.grooscript.grails.util.Util.*

/**
* User: jorgefrancoleza
* Date: 13/10/13
*/
class PhantomJsCase extends GroovyTestCase {

private static final FUNCTION_NAME = 'gsTestFunction'

@Autowired
LinkGenerator grailsLinkGenerator

//TODO not working atm, need fix in grooscript
def phantomJs(params) {
if (params.controller && params.code) {
def url = grailsLinkGenerator.link(params)
def converter = new GsConverter()
converter.classPath = 'src/main'
def testCode = converter.toJs("def ${FUNCTION_NAME} = { -> \n" + params.code + "\n}\n")
if (!grailsLinkGenerator.getContextPath()) {
url += '/grooscript-vertx'
}
println 'url->'+url
println 'basr->'+grailsLinkGenerator.getServerBaseURL()
println 'context->'+grailsLinkGenerator.getContextPath()
println 'testCode->'+testCode
PhantomJsTestImpl.doPhantomJsTest(url, testCode, FUNCTION_NAME)
} else {
consoleError 'Need define "controller" and "code" params at least'
}
}
}
12 changes: 0 additions & 12 deletions src/groovy/org/grooscript/grails/test/MixinUtils.groovy

This file was deleted.

@@ -1,6 +1,7 @@
package org.grooscript.grails.plugin

import org.grooscript.asts.PhantomJsTest
import org.grooscript.grails.plugin.test.PhantomJsCase

/**
* @author Jorge Franco
Expand Down Expand Up @@ -43,4 +44,11 @@ class PhantomJsTests extends PhantomJsCase {
void testWaitSeconds() {
assert $('#points').html() == '.',"points Html after is ${$('#points').html()}"
}

/*void testInMainController() {
phantomJs(controller: 'main', code: '''
assert true
''')
assert true
}*/
}

0 comments on commit c596c2b

Please sign in to comment.