-
-
Save sritchie/1685634 to your computer and use it in GitHub Desktop.
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
(ns ybot.kwphrase-tests | |
(:use [ybot.analytics.ga kwphrase] | |
[ybot datastores] | |
[midje sweet cascalog])) | |
(let [ga-data [["20121025" | |
"http://dopeness.org" | |
"United States" | |
"Oregon" | |
"Portland" | |
"filtered" | |
"google" | |
"5" | |
"2" | |
"2" | |
"true" | |
"2" | |
"0"] | |
["20121025" | |
"http://dopeness.org" | |
"United States" | |
"Oregon" | |
"Portland" | |
"passed" | |
"google" | |
"8" | |
"4" | |
"4" | |
"true" | |
"4" | |
"0"]] | |
ngram-data [["filtered" "filtered"] | |
["passed" "passed"]]] | |
(fact | |
(landings-by-ngram (gadata-tap :ga-tap) (ngram-generator :ngram-gen) 3) | |
=not=> (produces-some [["filtered" 2 5 2 2 0 100.0 100.0 0 2.5]]) | |
(provided | |
(gadata-tap :ga-tap) => ga-data | |
(ngram-generator :ngram-gen) => ngram-data))) | |
;; or | |
(fact | |
(landings-by-ngram ga-data ngram-data 3) | |
=not=> (produces-some [["filtered" 2 5 2 2 0 100.0 100.0 0 2.5]])) |
Me too! This was a fork showing that rather than mocking a generator, you can pass a data structure in directly. I'm loving this.
An unrelated but very cool feature is folded fakes: https://github.com/marick/Midje/wiki/Folded-prerequisites
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I like the second option, myself.