Skip to content

Instantly share code, notes, and snippets.

@philipbjorge
Created January 19, 2013 08:46
Show Gist options
  • Save philipbjorge/4571480 to your computer and use it in GitHub Desktop.
Save philipbjorge/4571480 to your computer and use it in GitHub Desktop.
smackit-rb
class Counter
attr_accessor :data
def initialize(initial)
@data = initial
end
end
expected = [0, 1, 2, 0, 5]
actual = []
c = Counter.new 0
actual << c.data
c.data = 1
actual << c.data
c.data = 2
actual << c.data
c = c.smackit
actual << c.data
c.data = 5
actual << c.data
assert(expected == actual, "expected and actual should match if smackit is working")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment