Skip to content

Instantly share code, notes, and snippets.

@JonRowe
Created March 13, 2012 18:51
Show Gist options
  • Save JonRowe/2030703 to your computer and use it in GitHub Desktop.
Save JonRowe/2030703 to your computer and use it in GitHub Desktop.
class Scanner
def initialize(display)
@display = display
end
def scan
@display.last_item = Item.new("Cornflakes")
end
end
Item = Struct.new(:name)
describe Scanner do
attr_accessor :last_item
specify 'scan adds an item to the display' do
Scanner.new(self).scan
last_item.should == Item.new('Cornflakes')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment