Skip to content

Commit

Permalink
reduce nesting for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
zefer committed Mar 20, 2015
1 parent db94716 commit 58e8000
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions handlers/playlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,27 +214,25 @@ var _ = Describe("PlayListHandler", func() {
})
})

Describe("clearing the playlist", func() {
Context("with replace=true", func() {
It("clears the playlist", func() {
clearCalled = false
validParams["replace"] = true
json, _ := json.Marshal(validParams)
req, _ := http.NewRequest("POST", "/playlist", bytes.NewBuffer(json))
handler.ServeHTTP(w, req)
Expect(clearCalled).To(Equal(true))
})
Context("with replace=true", func() {
It("clears the playlist", func() {
clearCalled = false
validParams["replace"] = true
json, _ := json.Marshal(validParams)
req, _ := http.NewRequest("POST", "/playlist", bytes.NewBuffer(json))
handler.ServeHTTP(w, req)
Expect(clearCalled).To(Equal(true))
})
})

Context("with replace=false", func() {
It("does not clear the playlist", func() {
clearCalled = false
validParams["replace"] = false
json, _ := json.Marshal(validParams)
req, _ := http.NewRequest("POST", "/playlist", bytes.NewBuffer(json))
handler.ServeHTTP(w, req)
Expect(clearCalled).To(Equal(false))
})
Context("with replace=false", func() {
It("does not clear the playlist", func() {
clearCalled = false
validParams["replace"] = false
json, _ := json.Marshal(validParams)
req, _ := http.NewRequest("POST", "/playlist", bytes.NewBuffer(json))
handler.ServeHTTP(w, req)
Expect(clearCalled).To(Equal(false))
})
})
})
Expand Down

0 comments on commit 58e8000

Please sign in to comment.