From b225db17cc626b4f43270872a12bd61f37397d17 Mon Sep 17 00:00:00 2001 From: Scott Johnson Date: Sun, 21 Aug 2016 23:34:43 -0400 Subject: [PATCH] Add some simple fun routines to get used to working on Betty --- lib/fun.rb | 13 +++++++++++++ lib/{_template.rb => template.rb} | 0 spec/fun_spec.rb | 8 ++++++++ 3 files changed, 21 insertions(+) rename lib/{_template.rb => template.rb} (100%) diff --git a/lib/fun.rb b/lib/fun.rb index 1744e76..99ddd7d 100755 --- a/lib/fun.rb +++ b/lib/fun.rb @@ -8,6 +8,19 @@ def self.interpret(command) } end + if command.match(/^superman\s+vs\s+batman$/i) + responses << { + say: [true,false].sample ? "Batman" : "Superman" + } + end + + if command.match(/^what\s+if\s+batman\s+does\snot\s+have\s+a?n?y?\s*kryptonite$/i) + responses << { + say: "Batman always has kryptonite" + } + end + + if command.match(/^open\s(the\s)?pod\sbay\sdoor(s)?$/i) responses << { :say => "I'm sorry, Dave. I'm afraid I can't do that." diff --git a/lib/_template.rb b/lib/template.rb similarity index 100% rename from lib/_template.rb rename to lib/template.rb diff --git a/spec/fun_spec.rb b/spec/fun_spec.rb index 4ef29a9..8c24106 100644 --- a/spec/fun_spec.rb +++ b/spec/fun_spec.rb @@ -13,5 +13,13 @@ context 'sudo make me a sandwich' do it { responds_with say: "I think you meant to place sudo at the start of the command." } end + + context "what if batman does not have any kryptonite" do + it { responds_with say: "Batman always has kryptonite" } + end + + context "what if batman does not have kryptonite" do + it { responds_with say: "Batman always has kryptonite" } + end end