Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for taglibs with custom namespace don't work #62

Open
ppazos opened this issue Aug 17, 2020 · 1 comment
Open

Tests for taglibs with custom namespace don't work #62

ppazos opened this issue Aug 17, 2020 · 1 comment

Comments

@ppazos
Copy link

ppazos commented Aug 17, 2020

FYI: found this test but it's @ignored

Task List

When the tests are executed, the one for the taglibs fail: Tag [isLoggedIn] does not exist. No tag library found for namespace: sa

The tablig is defined in the 'sa" namespace:

package com.cabolabs.security

class SimpleAuthTagLib {
   static namespace = 'sa'
   static defaultEncodeAs = [taglib:'html']
   //static encodeAsForTags = [tagName: [taglib:'html'], otherTagName: [taglib:'none']]

   def isLoggedIn = { attrs, body ->
      def man = SessionManager.getInstance()
      if (man.hasSession(session.id.toString()))
      {
         out << body()
      }
   }
}

The issue is in the def output = applyTemplate('<sa:isLoggedIn>hidden content</sa:isLoggedIn>')

https://github.com/ppazos/grails-simple-auth/blob/master/src/test/groovy/com/cabolabs/security/SimpleAuthTagLibSpec.groovy#L28

Steps to Reproduce

  1. clone https://github.com/ppazos/grails-simple-auth
  2. use grails 3.3.10
  3. grails test-app

Expected Behaviour

Should execute the taglib and return some output to compare with the expected behavior.

Actual Behaviour

ERROR: Tag [isLoggedIn] does not exist. No tag library found for namespace: sa

Environment Information

  • Operating System: Linux Mint 19
  • Grails Version: 3.3.10
  • JDK Version: openjdk version "1.8.0_252"
    OpenJDK Runtime Environment (build 1.8.0_252-b09)
    OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

Example Application

it's a plugin: https://github.com/ppazos/grails-simple-auth

@IanSolomon
Copy link

@ppazos this looks to be caused by missing the gsp plugin you can add it something like compile "org.grails.plugins:gsp" to your build.gradle and it should resolve the issue in the tests.
I came across a similar issue and tried that and looks to fix it. sharing this here in case it is helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants