<commit_before>package main.doge

import spock.lang.Specification

class FirstPipelineSpec extends Specification {

    @Delegate PipelineTestHelper pipelineTestHelper = new PipelineTestHelper()

    def setup() {
        pipelineTestHelper.setUp()
    }

    def 'does something'() {
        def invocations = []

        given:
        def shellMock = Mock(Closure)
        shellMock.call(_) >> { args ->
            invocations << args
        }

        helper.registerAllowedMethod('sh', [String], shellMock)

        when:
        def script = loadScript('../Jenkinsfile')
        script.execute()

        then:
        assert invocations == []

    }
}<commit_msg>DOGE-91 Remy/Maisam testing jenkinsfile<commit_after>package main.doge

import spock.lang.Specification

import static com.lesfurets.jenkins.unit.MethodCall.callArgsToString

class FirstPipelineSpec extends Specification {

    @Delegate PipelineTestHelper pipelineTestHelper = new PipelineTestHelper()

    def setup() {
        pipelineTestHelper.setUp()
    }

    def 'should determine first sh call in jenkinsfile'() {
        def invocations = []

        given:
        def shellMock = Mock(Closure)
        shellMock.call(_) >> { args ->
            invocations << args
        }

        helper.registerAllowedMethod('sh', [String], shellMock)

        when:
        def script = loadScript('../Jenkinsfile')
        script.execute()

        then:
        assert invocations.first() == ['./gradlew test']

    }

    def 'should call gradlew test in the jenkinsfile'() {
        given:

        when:
        loadScript('../Jenkinsfile')

        then:
        callArgsToString(helper.callStack.findAll { call ->
            call.methodName == 'sh'
        }.first()) == './gradlew test'
    }
}
{'fraction_non_alphanumeric': 0.10692177827799662, 'fraction_numerical': 0.0011254924029262803, 'mean_word_length': 2.2804428044280445, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2405113', 'n_tokens_mistral': 520, 'n_tokens_neox': 488, 'n_words': 112}