Last active
December 27, 2015 00:49
-
-
Save jahio/7240249 to your computer and use it in GitHub Desktop.
ruby test inside script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "test/unit" | |
class SomeClass | |
end | |
if $0 == __FILE__ | |
class SomeClassTestUnit < Test::Unit::TestCase | |
def test_something | |
# does something here | |
end | |
end | |
end |
class MyClass
def speak
"bark"
end
end
if $0 == __FILE__
require "test/unit"
class MyTestUnit < Test::Unit::TestCase
# test MyClass here
def test_speak
assert_equal 'bark', MyClass.new.speak
end
end
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes. THen you would run `ruby gistfile1.rb'