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

Indent Spock blocks #13

Closed
mitc0185 opened this issue Jun 11, 2015 · 2 comments
Closed

Indent Spock blocks #13

mitc0185 opened this issue Jun 11, 2015 · 2 comments

Comments

@mitc0185
Copy link

I will freely admit I am new to both Groovy and Spock, and not enough of an Emacs hacker to take this on alone.

When I'm writing spock in groovy mode, the blocks (given, when, then, etc...) are not being indented in the same way that other statements would be.

Example:

class ResourceOwnerPasswordCredentialsSpec extends Specification {

  def "Ability to get access token with valid client and user credentials"() {

  given:
  def http = new HTTPBuilder('https://gdmlx0016.hq.bigcompany.com:8445')
  http.ignoreSSLIssues()

  def postBody = [grant_type: 'password', username: '[email protected]', password: 'password123']

  when:
  def resp = http.post( path : '/oauth/token', body: postBody, headers: [ Authorization: 'Basic OGFiNjJhOWMtMWI4Ni00ZDJhLTlkNGItMTUwODJiYzNmMDA0OjNpSnRQamVNdkk='] )

  then:
  resp.access_token.size() == 103

  } 
}

If I highlight all of that code and hit tab, the "given:" line does not tab in. I would expect that it would. If I put a regular statement above that line, it does get indented.

class ResourceOwnerPasswordCredentialsSpec extends Specification {
  def "Ability to get access token with valid client and user credentials"() {

    def indentationIsWorkingHere = true

  given:
  def http = new HTTPBuilder('https://gdmlx0016.hq.bigcompany.com:8445')
  http.ignoreSSLIssues()

  def postBody = [grant_type: 'password', username: '[email protected]', password: 'password123']

  when:
  def resp = http.post( path : '/oauth/token', body: postBody, headers: [ Authorization: 'Basic OGFiNjJhOWMtMWI4Ni00ZDJhLTlkNGItMTUwODJiYzNmMDA0OjNpSnRQamVNdkk='] )

  then:
  resp.access_token.size() == 103

  } 
}

Is this something I can fix in my .emacs file? Or is the mode not catching this type of line? When I look at other examples of spock tests I'm seeing these lines indented.

@russel
Copy link
Contributor

russel commented Jul 25, 2015

I think there is a problem with the default style rules. My personal set up is so amended from the default, I am seeing much more weird (wrong) stuff ;-)

@russel
Copy link
Contributor

russel commented May 16, 2017

We have changed the Groovy mode from being a CC-Mode derived one to being a standalone one. We are therefore closing all issues relating to the old mode. If you try the new mode and see any problems please post a new issue.

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

No branches or pull requests

2 participants