Skip to content

Instantly share code, notes, and snippets.

@sonianand11
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sonianand11/8120a690ad493f5b999b to your computer and use it in GitHub Desktop.
Save sonianand11/8120a690ad493f5b999b to your computer and use it in GitHub Desktop.
This is for testing
class Foo
def initialize(thing)
@thing = thing
end
def test_me
if @thing.big?
'Big!'
else
'Small!'
end
end
end
require "test/unit"
class TestFoo < Test::Unit::TestCase
def test_simple
assert_equal('Big!', Foo.new('Big!').test_me )
end
end
@richmolj
Copy link

[1,2,3].each do |i|
puts i
end

@richmolj
Copy link

module Foo
  def blah;puts 'helo';end
end

class Bar
end

# how do I do this?
Bar.new.blah

# how do I do this?
Bar.blah

@richmolj
Copy link

class Foo
  def initialize(thing)
    @thing = thing
  end

  def test_me
    if @thing.big?
      'Big!'
    else
      'Small!'
    end
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment