Skip to content

Commit

Permalink
Skip describe test
Browse files Browse the repository at this point in the history
Add a test for g.Skip.Describe()
  • Loading branch information
semur nabiev authored and semur nabiev committed Apr 16, 2020
1 parent dd6f54b commit afa2e4e
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
66 changes: 66 additions & 0 deletions describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,69 @@ func TestNestedAfter(t *testing.T) {
t.Fatal("Failed")
}
}

func TestSkipDescribe(t *testing.T) {
g := Goblin(t)

g.Describe("Describe will run", func() {

g.It("This will run", func() {
g.Assert(4).Equal(4)
})
})

g.Skip.Describe("Describe will not run", func() {

g.Before(func() {
t.Fatal("This Before() should not run")
})
g.After(func() {
t.Fatal("This After() should not run")
})

g.BeforeEach(func() {
t.Fatal("This BeforeEach() should not run")
})
g.AfterEach(func() {
t.Fatal("This AfterEach() should not run")
})

g.JustBeforeEach(func() {
t.Fatal("This JustBeforeEach() should not run")
})

g.It("This will not run", func() {
t.Fatal("Failed")
})

g.Describe("Describe will not run also", func() {
g.Before(func() {
t.Fatal("This Before() should not run")
})
g.After(func() {
t.Fatal("This After() should not run")
})
g.It("This will not run also", func() {
t.Fatal("Failed")
})
})
})

g.Describe("Last describe will run", func() {

counter := 0

g.Before(func() {
counter++
})
g.BeforeEach(func() {
counter++
})
g.JustBeforeEach(func() {
counter++
})
g.It("This will run", func() {
g.Assert(counter).Equal(3)
})
})
}
4 changes: 4 additions & 0 deletions reporting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ func (r *FakeReporter) BeginDescribe(name string) {
r.describes = append(r.describes, name)
}

func (r *FakeReporter) BeginXdescribe(name string) {
r.BeginDescribe(name)
}

func (r *FakeReporter) EndDescribe() {
r.ends++
}
Expand Down

0 comments on commit afa2e4e

Please sign in to comment.