Untitled

 avatar
unknown
plain_text
a year ago
913 B
4
Indexable
class ContractSpec extends SozztSpecification {


    def setup(){
        given: "$MONIKA_CONTRACT_INTRODUCER is logged in"
            loginUser(MONIKA_CONTRACT_INTRODUCER)
    }

    def "Should add a new contract"() {
        when: "$MONIKA_CONTRACT_INTRODUCER adds a new contract"
            ContractDto contract = contractFacade.addContract(toCreateContractDto(KRYNICA_CONTRACT))
        then: "New contract is added"
            contract == KRYNICA_CONTRACT
    }

    def "should not add a new contract if does not have permission"() {
        given: "$DAREK_PRELIMINARY_PLANER is logged in"
            loginUser(DAREK_PRELIMINARY_PLANER)
        when: "$DAREK_PRELIMINARY_PLANER adds new contract"
            contractFacade.addContract(toCreateContractDto(KRYNICA_CONTRACT))
        then: "contract is not added"
            thrown(UnauthorizedContractAdditionException)
    }
}
Editor is loading...
Leave a Comment