code, tests and command line, all in one file
# main logic
def hi
'hi'
end
# rspec tests
require 'rspec'
describe "hi" do
it "says 'hi'" do
hi.should == 'hi'
end
end
# command line
if __FILE__ == $0
puts hi
end
Written by yanhaoyang
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#