redding / assert

Assertion style testing framework.
https://github.com/redding/assert
MIT License
10 stars 1 forks source link

`assert_{not_}defined` assertion helpers #153

Closed kellyredding closed 10 years ago

kellyredding commented 10 years ago

for asserting things are defined; use `defined?(...)'; show detailed fail message

kellyredding commented 10 years ago

@jcredding so I am an idiot and this assertion won't work. See below:

# irb
>> Poop
NameError: uninitialized constant Poop
>> def assert_defined(thing); puts defined?(thing).inspect; end
=> nil
>> assert_defined 1
"local-variable"
=> nil
>> assert_defined Poop
NameError: uninitialized constant Poop

You can't pass something undefined to assert_defined method without getting a NameError (duh!).