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…