summaryrefslogtreecommitdiffstats
path: root/helpers/url_test.go
diff options
context:
space:
mode:
authorspf13 <steve.francia@gmail.com>2015-05-20 02:21:21 -0400
committerspf13 <steve.francia@gmail.com>2015-05-20 02:21:21 -0400
commita584ff207b4ee951e4b25cf5cedf6d261ee1bc47 (patch)
tree4273e35cfd90493ed0d25d53450285b61c527418 /helpers/url_test.go
parent599d1b9786ddbaa9203aaca2c96ab33b40a583b1 (diff)
Stop Viper from leaking across many of the tests (now tests pass regardless of order tested)
Diffstat (limited to 'helpers/url_test.go')
-rw-r--r--helpers/url_test.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/helpers/url_test.go b/helpers/url_test.go
index bfd211b89..001daf109 100644
--- a/helpers/url_test.go
+++ b/helpers/url_test.go
@@ -1,10 +1,11 @@
package helpers
import (
- "github.com/spf13/viper"
- "github.com/stretchr/testify/assert"
"strings"
"testing"
+
+ "github.com/spf13/viper"
+ "github.com/stretchr/testify/assert"
)
func TestURLize(t *testing.T) {
@@ -28,6 +29,7 @@ func TestURLize(t *testing.T) {
}
func TestAbsURL(t *testing.T) {
+ defer viper.Reset()
tests := []struct {
input string
baseURL string
@@ -41,6 +43,7 @@ func TestAbsURL(t *testing.T) {
}
for _, test := range tests {
+ viper.Reset()
viper.Set("BaseURL", test.baseURL)
output := AbsURL(test.input)
if output != test.expected {
@@ -50,7 +53,8 @@ func TestAbsURL(t *testing.T) {
}
func TestRelURL(t *testing.T) {
- defer viper.Set("canonifyURLs", viper.GetBool("canonifyURLs"))
+ defer viper.Reset()
+ //defer viper.Set("canonifyURLs", viper.GetBool("canonifyURLs"))
tests := []struct {
input string
baseURL string
@@ -70,6 +74,7 @@ func TestRelURL(t *testing.T) {
}
for i, test := range tests {
+ viper.Reset()
viper.Set("BaseURL", test.baseURL)
viper.Set("canonifyURLs", test.canonify)