Skip to content

Instantly share code, notes, and snippets.

@mdeiters
Created April 22, 2010 10:04
Show Gist options
  • Select an option

  • Save mdeiters/375051 to your computer and use it in GitHub Desktop.

Select an option

Save mdeiters/375051 to your computer and use it in GitHub Desktop.
require File.join(File.dirname(__FILE__), '..', 'test_helper')
# See all assertions: http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/
# Run all tests: rake test
# Run this test: ruby test/unit/ruby_test.rb
class RubyTest < ActiveSupport::TestCase
test "that true is the same as true" do
assert true == true
end
test 'that true and false are different' do
assert true != false
end
test 'that the reverse of ruby is ybur' do
assert_equal 'ruby'.reverse, 'ybur'
end
test 'that 4 plus 5 is 9' do
result = 4 + 5
assert_equal result, 9
end
test 'figuring out years since my birthday' do
require 'date'
birthdate = Date.parse('10/20/1980')
year_of_birth = birthdate.year
todays_year = Date.today.year
years_since_born = todays_year - year_of_birth
assert_equal 30, years_since_born
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment