-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GoLint, Adds method for PrefixQueueInDev (#9)
- Loading branch information
1 parent
96ac5e4
commit 0f3bb55
Showing
5 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package rabbit | ||
|
||
func stringInSlice(a string, list []string) bool { | ||
for _, b := range list { | ||
if b == a { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package rabbit_test | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"os/user" | ||
"testing" | ||
|
||
"github.com/brettallred/rabbit-go" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestPrefixQueueInDev(t *testing.T) { | ||
var subscriber = rabbit.Subscriber{ | ||
Concurrency: 5, | ||
Durable: true, | ||
Exchange: "events", | ||
Queue: "test.sample.event.created", | ||
RoutingKey: "sample.event.created", | ||
} | ||
|
||
os.Setenv("APP_ENV", "development") | ||
subscriber.PrefixQueueInDev() | ||
userData, _ := user.Current() | ||
|
||
assert.Equal(t, subscriber.Queue, fmt.Sprintf("%s_test.sample.event.created", userData.Username)) | ||
} |