Skip to content

Instantly share code, notes, and snippets.

View chuckxD's full-sized avatar
💩
I may be slow to respond.

Chuck Schleutker chuckxD

💩
I may be slow to respond.
View GitHub Profile
# CLOSURES IN RUBY Paul Cantrell http://innig.net
# Email: username "cantrell", domain name "pobox.com"
# I recommend executing this file, then reading it alongside its output.
#
# Alteratively, you can give yourself a sort of Ruby test by deleting all the comments,
# then trying to guess the output of the code!
# A closure is a block of code which meets three criteria:
#
#!/usr/bin/env ruby
#
# Genghis v2.3.8
#
# The single-file MongoDB admin app
#
# http://genghisapp.com
#
# @author Justin Hileman <[email protected]>
#
test 'exclude user if already triggered today with different hash' do
# default profile, user has email, viewed something yesterday
Cie::Data.profiles('Test').insert({'_id' => USER0, 'email' => EMAIL, 'timestamp' => YESTERDAY})
Cie::Data.views('Test').insert({'user_id' => USER0, 'SkuID' => SKU+'view-yesterday', 'timestamp' => YESTERDAY})
Cie::Data.triggers('Test').insert({'the_hash' => 'other', 'trigger_date' => Time.now, 'email_address' => EMAIL})
users = AbandonProduct.get_users('Test', 'h', 1, 0)
assert_equal(0, users.count)
end