Skip to content

Instantly share code, notes, and snippets.

@YanhaoYang
Created May 14, 2014 00:17
Show Gist options
  • Save YanhaoYang/3e14f30ee86f2ce753ae to your computer and use it in GitHub Desktop.
Save YanhaoYang/3e14f30ee86f2ce753ae to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment