Skip to content

where block cannot access or declare variables? #138

@robfletcher

Description

@robfletcher

Originally reported on Google Code with ID 15

i would expect to be able to do this:

def "my test"() {
  given:
      def a = new Apple()
      def o = new Orange()

  when:
      fruit = f
  then: 
      <something>
  where:
       f << [a, o, a, o, a, o]  
}

But I get MissingPropertyException for a & o.  I also tried declaring a & o in the
where block - same issue.  Declaring them outside the 
scope of the method works but is not ideal.  I ended up unrolling the where into several
when/then blocks.

I see that the documentation for the where block is coming (at light speed :) so maybe
this is as designed.

Thanks

Reported by jacobsonz on 2009-03-12 18:07:08

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions