title: SpockFramework Global Mocks not working as expected
body: <p>I'm using the following test as an example to showcase a similar issue I'm seeing. I think it's just a misunderstanding on my part about how global mocks work in SpockFramework.</p>
  
  <pre><code>  void "test"() {
      when:
      TestStage stage = new TestStage("John")
      GroovyMock(TestStep.class, global: true) {
        getName() &gt;&gt; "Joe"
      }
      then:
      stage.run() == "Joe"
    }
  </code></pre>
  
  <p>This test should create a test stage supplying a default name. But then I create a global mock of a class inside of <code>TestStage</code> to override the return value. IE: I'm only trying to test the functionality of <code>TestStage</code> not <code>TestStep</code>. If <code>TestStep</code> were to make only changes, I don't want to know about them, I'll test those separately. However when I run this test, it looks like the global mock never takes effect as the returned name is still <code>"John"</code>, which is what I supplied originally.</p>
  
  <pre><code>stage.run() == "Joe"
  |     |     |
  |     John  false
  </code></pre>
  
  <p>Here's the two sample classes used to test this.</p>
  
  <pre><code>class TestStage {
    TestStep step
  
    TestStage(String name) {
      this.step = new TestStep(name)
    }
  
    String run() {
      return step.getName()
    }
  
  }
  </code></pre>
  
  <pre><code>class TestStep {
      private String name
  
      TestStep(String name) {
        this.name = name
      }
  
      String getName() {
        return this.name
      }
  }
  </code></pre>