From: tamouse mailing lists Date: 2013-02-05T22:52:11+09:00 Subject: Re: old syntax? what's going on here On Tue, Feb 5, 2013 at 7:47 AM, Carlo E. Prelz wrote: > Subject: old syntax? what's going on here > Date: mar 05 feb 13 10:33:35 +0900 > > Quoting tamouse mailing lists (tamouse.lists@gmail.com): > >> I have this in a _spec.rb file: (a gem I inherited at work) >> >> Open3.expects(:popen3).with do |command| >> case part_of_command >> when Regexp: command =~ part_of_command >> when String: command.include?(part_of_command) >> else raise "Can't match that" >> end >> end > > Are you sure that code ever worked? > > From my very worn copy of "Ruby in a nutshell": > > "A *when* statement's *expression* is separated from *code* by the > reserved word *then*, a newline, or a semicolon." > > That colon should be a semicolon (or *then* or a newline)... Heh, no -- I've inherited this little bit of thing that no one in the group has ever done much with.