test_env
My own personal test environment
Example
require 'test_env'
class User
attr_accessor :username, :email
def to_s
"#{@username} - #{@email}"
end
end
class UserTest < TestEnvironment
test_instance_of User do |user|
# Setups run once before any assertions ever take place
# You can have multiple setup blocks
setup do
@username = 'default'
@email = '[email protected]'
end
assert 'output str should be correct' do
user.to_s == 'default - [email protected]'
end
assert 'output str should still be correct' do
user.username = 'c00lryguy'
user.email = '[email protected]'
user.to_s == 'c00lryguy - [email protected]'
end
end
end
Note on Patches/Pull Requests
- Fork the project.
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don't break it in a future version unintentionally.
- Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
- Send me a pull request. Bonus points for topic branches.
Copyright
Copyright (c) 2010 Ryan Lewis. See LICENSE for details.