2013/2/5 tamouse mailing lists <[email protected]> > > 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 > > which ruby is complaining about: > > spec/ruby_gpg_spec.rb:7: syntax error, unexpected ':', expecting > keyword_then or ',' or ';' or '\n' > when Regexp: command =~ part_of_command > ^ > spec/ruby_gpg_spec.rb:8: syntax error, unexpected keyword_when, > expecting keyword_end > when String: command.include?(part_of_command) > ^ > spec/ruby_gpg_spec.rb:9: syntax error, unexpected keyword_else, > expecting keyword_end > else raise "Can't match that" > ^ > spec/ruby_gpg_spec.rb:241: syntax error, unexpected keyword_end, expecting > $end > > I'm completely unfamiliar with what is supposed to be happening above, > but I rather assume that Regexp: and String: have something to do with > the Open3.expects bit. > > I'm a bit pressed for time right now, can anyone give me some fast > pointers? Already delving into Open3... > The above case syntax is legitimate in ruby 1.8 but not in 1.9. Refer to http://blog.grayproductions.net/articles/getting_code_ready_for_ruby_19
Regards, Park Heesob -- [email protected] | https://groups.google.com/d/forum/ruby-talk-google?hl=en --- You received this message because you are subscribed to the Google Groups "ruby-talk-google" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
