specification

package
v0.0.0-...-044f632 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotStorySlug    = errors.New("not story slug")
	ErrNotScenarioSlug = errors.New("not scenario slug")
	ErrNotThesisSlug   = errors.New("not thesis slug")
)
View Source
var ErrNoHTTPRequest = errors.New("no request")
View Source
var ErrNoScenarioTheses = errors.New("no theses")
View Source
var ErrNoSpecificationStories = errors.New("no stories")
View Source
var ErrNoStoryScenarios = errors.New("no scenarios")
View Source
var ErrUselessThesis = errors.New("useless thesis")

Functions

func NewNotAllowedAssertionMethodError

func NewNotAllowedAssertionMethodError(method AssertionMethod) error

func NewNotAllowedContentTypeError

func NewNotAllowedContentTypeError(contentType ContentType) error

func NewNotAllowedHTTPMethodError

func NewNotAllowedHTTPMethodError(method HTTPMethod) error

func NewNotAllowedStageError

func NewNotAllowedStageError(stage Stage) error

func NewUndefinedDependencyError

func NewUndefinedDependencyError(slug Slug) error

Types

type Assert

type Assert struct {
	// contains filtered or unexported fields
}

func NewAssert

func NewAssert(actual string, expected interface{}) Assert

func (Assert) Actual

func (a Assert) Actual() string

func (Assert) Expected

func (a Assert) Expected() interface{}

type Assertion

type Assertion struct {
	// contains filtered or unexported fields
}

func (Assertion) Asserts

func (a Assertion) Asserts() []Assert

func (Assertion) IsZero

func (a Assertion) IsZero() bool

func (Assertion) Method

func (a Assertion) Method() AssertionMethod

type AssertionBuilder

type AssertionBuilder struct {
	// contains filtered or unexported fields
}

func (*AssertionBuilder) Build

func (b *AssertionBuilder) Build() Assertion

func (*AssertionBuilder) Reset

func (b *AssertionBuilder) Reset()

func (*AssertionBuilder) WithAssert

func (b *AssertionBuilder) WithAssert(actual string, expected interface{}) *AssertionBuilder

func (*AssertionBuilder) WithMethod

func (b *AssertionBuilder) WithMethod(method AssertionMethod) *AssertionBuilder

type AssertionMethod

type AssertionMethod string
const (
	UnknownAssertionMethod AssertionMethod = "!"
	NoAssertionMethod      AssertionMethod = ""
	JSONPath               AssertionMethod = "jsonpath"
)

func (AssertionMethod) IsValid

func (am AssertionMethod) IsValid() bool

func (AssertionMethod) String

func (am AssertionMethod) String() string

type BuildError

type BuildError struct {
	// contains filtered or unexported fields
}

func (*BuildError) As

func (e *BuildError) As(target interface{}) bool

func (*BuildError) Error

func (e *BuildError) Error() string

func (*BuildError) Errors

func (e *BuildError) Errors() []error

func (*BuildError) Is

func (e *BuildError) Is(target error) bool

func (*BuildError) SlugContext

func (e *BuildError) SlugContext() (Slug, bool)

func (*BuildError) StringContext

func (e *BuildError) StringContext() (string, bool)

type BuildErrorWrapper

type BuildErrorWrapper struct {
	// contains filtered or unexported fields
}

func (*BuildErrorWrapper) SluggedWrap

func (w *BuildErrorWrapper) SluggedWrap(slug Slug) error

func (*BuildErrorWrapper) WithError

func (w *BuildErrorWrapper) WithError(err error) *BuildErrorWrapper

func (*BuildErrorWrapper) Wrap

func (w *BuildErrorWrapper) Wrap(ctxMsg string) error

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func (*Builder) Build

func (b *Builder) Build() (*Specification, error)

func (*Builder) ErrlessBuild

func (b *Builder) ErrlessBuild() *Specification

func (*Builder) Reset

func (b *Builder) Reset()

func (*Builder) WithAuthor

func (b *Builder) WithAuthor(author string) *Builder

func (*Builder) WithDescription

func (b *Builder) WithDescription(description string) *Builder

func (*Builder) WithID

func (b *Builder) WithID(id string) *Builder

func (*Builder) WithLoadedAt

func (b *Builder) WithLoadedAt(loadedAt time.Time) *Builder

func (*Builder) WithOwnerID

func (b *Builder) WithOwnerID(ownerID string) *Builder

func (*Builder) WithStory

func (b *Builder) WithStory(slug string, buildFn func(b *StoryBuilder)) *Builder

func (*Builder) WithTestCampaignID

func (b *Builder) WithTestCampaignID(testCampaignID string) *Builder

func (*Builder) WithTitle

func (b *Builder) WithTitle(title string) *Builder

type ContentType

type ContentType string
const (
	UnknownContentType ContentType = "!"
	NoContentType      ContentType = ""
	ApplicationJSON    ContentType = "application/json"
	ApplicationXML     ContentType = "application/xml"
)

func (ContentType) IsValid

func (ct ContentType) IsValid() bool

func (ContentType) String

func (ct ContentType) String() string

type HTTP

type HTTP struct {
	// contains filtered or unexported fields
}

func (HTTP) IsZero

func (h HTTP) IsZero() bool

func (HTTP) Request

func (h HTTP) Request() HTTPRequest

func (HTTP) Response

func (h HTTP) Response() HTTPResponse

type HTTPBuilder

type HTTPBuilder struct {
	// contains filtered or unexported fields
}

func (*HTTPBuilder) Build

func (b *HTTPBuilder) Build() HTTP

func (*HTTPBuilder) Reset

func (b *HTTPBuilder) Reset()

func (*HTTPBuilder) WithRequest

func (b *HTTPBuilder) WithRequest(buildFn func(b *HTTPRequestBuilder)) *HTTPBuilder

func (*HTTPBuilder) WithResponse

func (b *HTTPBuilder) WithResponse(buildFn func(b *HTTPResponseBuilder)) *HTTPBuilder

type HTTPMethod

type HTTPMethod string
const (
	UnknownHTTPMethod HTTPMethod = "!"
	NoHTTPMethod      HTTPMethod = ""
	GET               HTTPMethod = "GET"
	POST              HTTPMethod = "POST"
	PUT               HTTPMethod = "PUT"
	PATCH             HTTPMethod = "PATCH"
	DELETE            HTTPMethod = "DELETE"
	OPTIONS           HTTPMethod = "OPTIONS"
	TRACE             HTTPMethod = "TRACE"
	CONNECT           HTTPMethod = "CONNECT"
	HEAD              HTTPMethod = "HEAD"
)

func (HTTPMethod) IsValid

func (m HTTPMethod) IsValid() bool

func (HTTPMethod) String

func (m HTTPMethod) String() string

type HTTPRequest

type HTTPRequest struct {
	// contains filtered or unexported fields
}

func (HTTPRequest) Body

func (r HTTPRequest) Body() map[string]interface{}

func (HTTPRequest) ContentType

func (r HTTPRequest) ContentType() ContentType

func (HTTPRequest) IsZero

func (r HTTPRequest) IsZero() bool

func (HTTPRequest) Method

func (r HTTPRequest) Method() HTTPMethod

func (HTTPRequest) URL

func (r HTTPRequest) URL() string

type HTTPRequestBuilder

type HTTPRequestBuilder struct {
	// contains filtered or unexported fields
}

func (*HTTPRequestBuilder) Build

func (b *HTTPRequestBuilder) Build() HTTPRequest

func (*HTTPRequestBuilder) Reset

func (b *HTTPRequestBuilder) Reset()

func (*HTTPRequestBuilder) WithBody

func (b *HTTPRequestBuilder) WithBody(body map[string]interface{}) *HTTPRequestBuilder

func (*HTTPRequestBuilder) WithContentType

func (b *HTTPRequestBuilder) WithContentType(contentType ContentType) *HTTPRequestBuilder

func (*HTTPRequestBuilder) WithMethod

func (b *HTTPRequestBuilder) WithMethod(method HTTPMethod) *HTTPRequestBuilder

func (*HTTPRequestBuilder) WithURL

func (b *HTTPRequestBuilder) WithURL(url string) *HTTPRequestBuilder

type HTTPResponse

type HTTPResponse struct {
	// contains filtered or unexported fields
}

func (HTTPResponse) AllowedCodes

func (r HTTPResponse) AllowedCodes() []int

func (HTTPResponse) AllowedContentType

func (r HTTPResponse) AllowedContentType() ContentType

func (HTTPResponse) IsZero

func (r HTTPResponse) IsZero() bool

type HTTPResponseBuilder

type HTTPResponseBuilder struct {
	// contains filtered or unexported fields
}

func (*HTTPResponseBuilder) Build

func (b *HTTPResponseBuilder) Build() HTTPResponse

func (*HTTPResponseBuilder) Reset

func (b *HTTPResponseBuilder) Reset()

func (*HTTPResponseBuilder) WithAllowedCodes

func (b *HTTPResponseBuilder) WithAllowedCodes(allowedCodes []int) *HTTPResponseBuilder

func (*HTTPResponseBuilder) WithAllowedContentType

func (b *HTTPResponseBuilder) WithAllowedContentType(
	allowedContentType ContentType,
) *HTTPResponseBuilder

type NotAllowedAssertionMethodError

type NotAllowedAssertionMethodError struct {
	// contains filtered or unexported fields
}

func (*NotAllowedAssertionMethodError) Error

func (*NotAllowedAssertionMethodError) Method

type NotAllowedContentTypeError

type NotAllowedContentTypeError struct {
	// contains filtered or unexported fields
}

func (*NotAllowedContentTypeError) ContentType

func (e *NotAllowedContentTypeError) ContentType() ContentType

func (*NotAllowedContentTypeError) Error

type NotAllowedHTTPMethodError

type NotAllowedHTTPMethodError struct {
	// contains filtered or unexported fields
}

func (*NotAllowedHTTPMethodError) Error

func (e *NotAllowedHTTPMethodError) Error() string

func (*NotAllowedHTTPMethodError) Method

type NotAllowedStageError

type NotAllowedStageError struct {
	// contains filtered or unexported fields
}

func (*NotAllowedStageError) Error

func (e *NotAllowedStageError) Error() string

func (*NotAllowedStageError) Stage

func (e *NotAllowedStageError) Stage() Stage

type Scenario

type Scenario struct {
	// contains filtered or unexported fields
}

func (Scenario) Description

func (s Scenario) Description() string

func (Scenario) Slug

func (s Scenario) Slug() Slug

func (Scenario) Theses

func (s Scenario) Theses() []Thesis

func (Scenario) ThesesByStages

func (s Scenario) ThesesByStages(stages ...Stage) []Thesis

func (Scenario) Thesis

func (s Scenario) Thesis(slug string) (thesis Thesis, ok bool)

type ScenarioBuilder

type ScenarioBuilder struct {
	// contains filtered or unexported fields
}

func (*ScenarioBuilder) Build

func (b *ScenarioBuilder) Build(slug Slug) Scenario

func (*ScenarioBuilder) Reset

func (b *ScenarioBuilder) Reset()

func (*ScenarioBuilder) WithDescription

func (b *ScenarioBuilder) WithDescription(description string) *ScenarioBuilder

func (*ScenarioBuilder) WithThesis

func (b *ScenarioBuilder) WithThesis(slug string, buildFn func(b *ThesisBuilder)) *ScenarioBuilder

type Slug

type Slug struct {
	// contains filtered or unexported fields
}

func NewScenarioSlug

func NewScenarioSlug(storySlug, scenarioSlug string) Slug

func NewStorySlug

func NewStorySlug(slug string) Slug

func NewThesisSlug

func NewThesisSlug(storySlug, scenarioSlug, thesisSlug string) Slug

func (Slug) IsZero

func (s Slug) IsZero() bool

func (Slug) Kind

func (s Slug) Kind() SlugKind

func (Slug) Partial

func (s Slug) Partial() string

Partial returns a Kind part of the Slug. If Slug is zero, return an empty string.

func (Slug) Scenario

func (s Slug) Scenario() string

func (Slug) ShouldBeScenarioKind

func (s Slug) ShouldBeScenarioKind() error

func (Slug) ShouldBeStoryKind

func (s Slug) ShouldBeStoryKind() error

func (Slug) ShouldBeThesisKind

func (s Slug) ShouldBeThesisKind() error

func (Slug) Story

func (s Slug) Story() string

func (Slug) String

func (s Slug) String() string

func (Slug) Thesis

func (s Slug) Thesis() string

func (Slug) ToScenarioKind

func (s Slug) ToScenarioKind() Slug

func (Slug) ToStoryKind

func (s Slug) ToStoryKind() Slug

func (Slug) ToThesisKind

func (s Slug) ToThesisKind() Slug

type SlugKind

type SlugKind string
const (
	NoSlug       SlugKind = ""
	StorySlug    SlugKind = "story"
	ScenarioSlug SlugKind = "scenario"
	ThesisSlug   SlugKind = "thesis"
)

type Specification

type Specification struct {
	// contains filtered or unexported fields
}

func (*Specification) Author

func (s *Specification) Author() string

func (*Specification) Description

func (s *Specification) Description() string

func (*Specification) ID

func (s *Specification) ID() string

func (*Specification) LoadedAt

func (s *Specification) LoadedAt() time.Time

func (*Specification) OwnerID

func (s *Specification) OwnerID() string

func (*Specification) Scenarios

func (s *Specification) Scenarios() []Scenario

func (*Specification) ScenariosCount

func (s *Specification) ScenariosCount() int

func (*Specification) Stories

func (s *Specification) Stories() []Story

func (*Specification) StoriesCount

func (s *Specification) StoriesCount() int

func (*Specification) Story

func (s *Specification) Story(slug string) (story Story, ok bool)

func (*Specification) TestCampaignID

func (s *Specification) TestCampaignID() string

func (*Specification) Theses

func (s *Specification) Theses() []Thesis

func (*Specification) ThesesCount

func (s *Specification) ThesesCount() int

func (*Specification) Title

func (s *Specification) Title() string

type Stage

type Stage string
const (
	NoStage      Stage = ""
	UnknownStage Stage = "!"
	Given        Stage = "given"
	When         Stage = "when"
	Then         Stage = "then"
)

func (Stage) Before

func (s Stage) Before() []Stage

func (Stage) IsValid

func (s Stage) IsValid() bool

func (Stage) String

func (s Stage) String() string

type Story

type Story struct {
	// contains filtered or unexported fields
}

func (Story) AsA

func (s Story) AsA() string

func (Story) Description

func (s Story) Description() string

func (Story) InOrderTo

func (s Story) InOrderTo() string

func (Story) Scenario

func (s Story) Scenario(slug string) (scenario Scenario, ok bool)

func (Story) Scenarios

func (s Story) Scenarios() []Scenario

func (Story) Slug

func (s Story) Slug() Slug

func (Story) WantTo

func (s Story) WantTo() string

type StoryBuilder

type StoryBuilder struct {
	// contains filtered or unexported fields
}

func (*StoryBuilder) Build

func (b *StoryBuilder) Build(slug Slug) Story

func (*StoryBuilder) Reset

func (b *StoryBuilder) Reset()

func (*StoryBuilder) WithAsA

func (b *StoryBuilder) WithAsA(asA string) *StoryBuilder

func (*StoryBuilder) WithDescription

func (b *StoryBuilder) WithDescription(description string) *StoryBuilder

func (*StoryBuilder) WithInOrderTo

func (b *StoryBuilder) WithInOrderTo(inOrderTo string) *StoryBuilder

func (*StoryBuilder) WithScenario

func (b *StoryBuilder) WithScenario(slug string, buildFn func(b *ScenarioBuilder)) *StoryBuilder

func (*StoryBuilder) WithWantTo

func (b *StoryBuilder) WithWantTo(wantTo string) *StoryBuilder

type Thesis

type Thesis struct {
	// contains filtered or unexported fields
}

func (Thesis) Assertion

func (t Thesis) Assertion() Assertion

func (Thesis) Behavior

func (t Thesis) Behavior() string

func (Thesis) Dependencies

func (t Thesis) Dependencies() []Slug

func (Thesis) HTTP

func (t Thesis) HTTP() HTTP

func (Thesis) Slug

func (t Thesis) Slug() Slug

func (Thesis) Stage

func (t Thesis) Stage() Stage

type ThesisBuilder

type ThesisBuilder struct {
	// contains filtered or unexported fields
}

func (*ThesisBuilder) Build

func (b *ThesisBuilder) Build(slug Slug) Thesis

func (*ThesisBuilder) Reset

func (b *ThesisBuilder) Reset()

func (*ThesisBuilder) WithAssertion

func (b *ThesisBuilder) WithAssertion(buildFn func(b *AssertionBuilder)) *ThesisBuilder

func (*ThesisBuilder) WithDependency

func (b *ThesisBuilder) WithDependency(dep string) *ThesisBuilder

func (*ThesisBuilder) WithHTTP

func (b *ThesisBuilder) WithHTTP(buildFn func(b *HTTPBuilder)) *ThesisBuilder

func (*ThesisBuilder) WithStatement

func (b *ThesisBuilder) WithStatement(stage Stage, behavior string) *ThesisBuilder

type UndefinedDependencyError

type UndefinedDependencyError struct {
	// contains filtered or unexported fields
}

func (*UndefinedDependencyError) Error

func (e *UndefinedDependencyError) Error() string

func (*UndefinedDependencyError) Slug

func (e *UndefinedDependencyError) Slug() Slug

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL