Skip to content

Instantly share code, notes, and snippets.

@ian-ellis
Created January 16, 2017 22:33
Show Gist options
  • Save ian-ellis/f1d1e1a93f273e2c682d746220c28f5a to your computer and use it in GitHub Desktop.
Save ian-ellis/f1d1e1a93f273e2c682d746220c28f5a to your computer and use it in GitHub Desktop.
package com.theiconic.spockexamples.common.domain.usecases
import com.theiconic.spockexamples.common.domain.usecases.ValidateEmailUseCase
import spock.lang.Specification
import spock.lang.Unroll
class ValidEmailUseCaseSpec extends Specification {
ValidateEmailUseCase useCase;
def setup() {
useCase = new ValidateEmailUseCase();
}
@Unroll
def 'execute() - validates email: #email returns #valid'() {
when:
def result = useCase.execute(email);
then:
result == valid
where:
email | valid
'[email protected]' | true
'1s__%[email protected]' | true
'ian.ellis @theiconic.com.au' | false
'ian@theiconic' | false
'ian.theinonic.com.au' | false
'[email protected]' | true
'[email protected]%ldka' | false
'[email protected]_sldka' | false
'[email protected]' | false
'[email protected]' | false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment