Skip to content

Instantly share code, notes, and snippets.

View dgiunta's full-sized avatar

Dave Giunta dgiunta

View GitHub Profile
module CustomMatchers
# Although, it's pretty crude, the BeRandom custom matcher attempts to check randomness.
#
# It would be invoked like follows:
# 1. lambda { perform_some_action }.should be_random
# 2. lambda { perform_some_action }.should be_random(7)
# 3. lambda { perform_some_action }.should be_random(7).with_a_tolerance_of(3)
#
# It takes a number of times (default is 10) to execute the lambda. Then, it expects
Feature: awesome feature
In order to see if this is awesome
As a coding dojo runner
I want to be able to pull this down like a plugin
@dgiunta
dgiunta / gist:67600
Created February 20, 2009 17:58 — forked from jkestr/gist:67593
def generate_attribute_list(only, except)
result = self.new.attribute_names
result &= [only].flatten unless only.blank?
result -= [except].flatten unless except.blank?
return result
end