Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(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]]))
@AlexBaranosky

This comment has been minimized.

Copy link

@AlexBaranosky AlexBaranosky commented Jan 27, 2012

I like the second option, myself.

@sritchie

This comment has been minimized.

Copy link
Owner Author

@sritchie sritchie commented Jan 27, 2012

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.

@AlexBaranosky

This comment has been minimized.

Copy link

@AlexBaranosky AlexBaranosky commented Jan 27, 2012

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
You can’t perform that action at this time.