Skip to content
This repository has been archived by the owner on Mar 27, 2021. It is now read-only.

Commit

Permalink
IsPublished was doing the opposite 🤦
Browse files Browse the repository at this point in the history
  • Loading branch information
agonzalezro committed Jul 31, 2016
1 parent e69284d commit 124e5bd
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 18 deletions.
2 changes: 1 addition & 1 deletion file/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ func (f ParsedFile) summaryOrFirstParagraph() string {
// IsPublished will return true if the status is not draft
// TODO: I wonder if `draft: true` could be a better way of doing this.
func (f ParsedFile) IsPublished() bool {
return f.status == "draft"
return strings.ToLower(f.status) != "draft"
}
16 changes: 16 additions & 0 deletions file/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package file

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestIsPublished(t *testing.T) {
assert := assert.New(t)

assert.True(ParsedFile{}.IsPublished())

assert.False(ParsedFile{status: "Draft"}.IsPublished())
assert.False(ParsedFile{status: "draft"}.IsPublished())
}
34 changes: 17 additions & 17 deletions templates/assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 124e5bd

Please sign in to comment.