jarvis-cli 0.0.7 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jarvis.rb +19 -2
  3. data/lib/jarvis/exceptions.rb +2 -3
  4. data/lib/jarvis/server.rb +2 -0
  5. data/lib/jarvis/services.rb +1 -0
  6. data/lib/jarvis/services/img_flip.rb +69 -0
  7. data/lib/jarvis/services/img_flip_memes/afraid_to_ask.rb +17 -0
  8. data/lib/jarvis/services/img_flip_memes/and_its_gone.rb +17 -0
  9. data/lib/jarvis/services/img_flip_memes/base_meme.rb +57 -0
  10. data/lib/jarvis/services/img_flip_memes/everywhere.rb +15 -0
  11. data/lib/jarvis/services/img_flip_memes/gonna_have_a_bad_time.rb +17 -0
  12. data/lib/jarvis/services/img_flip_memes/most_interesting_man.rb +13 -0
  13. data/lib/jarvis/services/img_flip_memes/not_sure_if.rb +13 -0
  14. data/lib/jarvis/services/img_flip_memes/one_does_not_simply.rb +17 -0
  15. data/lib/jarvis/services/img_flip_memes/overly_attached_girlfriend.rb +13 -0
  16. data/lib/jarvis/services/img_flip_memes/picard.rb +13 -0
  17. data/lib/jarvis/services/img_flip_memes/success_kid.rb +13 -0
  18. data/lib/jarvis/services/img_flip_memes/sudden_clarity.rb +13 -0
  19. data/lib/jarvis/services/img_flip_memes/what_if_i_told_you.rb +17 -0
  20. data/lib/jarvis/services/img_flip_memes/willy_wonka.rb +13 -0
  21. data/lib/jarvis/services/img_flip_memes/y_u_no.rb +17 -0
  22. data/lib/jarvis/version.rb +1 -1
  23. data/spec/services/img_flip_spec.rb +89 -0
  24. data/spec/support/fixtures/vcr_cassettes/img_flip_afraid_to_ask.yml +54 -0
  25. data/spec/support/fixtures/vcr_cassettes/img_flip_and_its_gone.yml +54 -0
  26. data/spec/support/fixtures/vcr_cassettes/img_flip_everywhere.yml +54 -0
  27. data/spec/support/fixtures/vcr_cassettes/img_flip_gonna_have_a_bad_time.yml +54 -0
  28. data/spec/support/fixtures/vcr_cassettes/img_flip_most_interesting_man.yml +54 -0
  29. data/spec/support/fixtures/vcr_cassettes/img_flip_not_sure_if.yml +54 -0
  30. data/spec/support/fixtures/vcr_cassettes/img_flip_one_does_not_simply.yml +54 -0
  31. data/spec/support/fixtures/vcr_cassettes/img_flip_overly_attached_girlfriend.yml +54 -0
  32. data/spec/support/fixtures/vcr_cassettes/img_flip_picard.yml +54 -0
  33. data/spec/support/fixtures/vcr_cassettes/img_flip_success_kid.yml +54 -0
  34. data/spec/support/fixtures/vcr_cassettes/img_flip_sudden_clarity.yml +54 -0
  35. data/spec/support/fixtures/vcr_cassettes/img_flip_what_if_I_told_you.yml +54 -0
  36. data/spec/support/fixtures/vcr_cassettes/img_flip_willy_wonka.yml +54 -0
  37. data/spec/support/fixtures/vcr_cassettes/img_flip_y_u_no.yml +54 -0
  38. metadata +48 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d9b5f3ee81fd1bb667dd0f7a3fa5f3f19e591ff
4
- data.tar.gz: 0b5163b44dc07dc62eed775950a2798639fb11dc
3
+ metadata.gz: 892d62136bdf6f60cddb1e58048be3b585dabe12
4
+ data.tar.gz: 3bf685aaa9d7212ccd401a6b2f3f6682df8d359b
5
5
  SHA512:
6
- metadata.gz: dae7eb953996d2788e95dc3e7a6791fbcac8269c7d6002e194aa8da0cf00c5cae987dc160ba92a5fd6ff19246b53322abc9c5773907ce38739165fbc09f79954
7
- data.tar.gz: 6afff6f34899940285e2920c1d3973f95ba45519ee3baf15694260db1ffcb8eae0b6809900e20f78e4f6cc9923c5c0ab2b05d48d0bdefb04f25a2a5921f444e7
6
+ metadata.gz: 416d63e868a5e398096b9c6e281e9e5ab38e637417e510d8ee84183fbb9925e53c5f482e97862cec4321bec6fd1df62a2b51cbb88c108983545634fc0d0f00be
7
+ data.tar.gz: 3cbe3f88db1ae04ef9cc9970ff6dddc039db8ba5a372a2a46548c06f0955af7beab7b01f263e12db3dbf027890c60dc451d8626c1e5f1ffdd33c4953b00d91ad
data/lib/jarvis.rb CHANGED
@@ -36,8 +36,25 @@ module Jarvis
36
36
  @services = []
37
37
  end
38
38
 
39
- def get(*args, &blk)
40
- Jarvis::API::Response.new HTTParty.get(*args, &blk)
39
+ # HTTP Requests
40
+ def get(path, options={}, &block)
41
+ Jarvis::API::Response.new HTTParty.get(path, options, &block)
42
+ end
43
+
44
+ def post(path, options={}, &block)
45
+ Jarvis::API::Response.new HTTParty.post(path, options, &block)
46
+ end
47
+
48
+ def patch(path, options={}, &block)
49
+ Jarvis::API::Response.new HTTParty.patch(path, options, &block)
50
+ end
51
+
52
+ def put(path, options={}, &block)
53
+ Jarvis::API::Response.new HTTParty.put(path, options, &block)
54
+ end
55
+
56
+ def delete(path, options={}, &block)
57
+ Jarvis::API::Response.new HTTParty.delete(path, options, &block)
41
58
  end
42
59
 
43
60
  def encode_uri(str)
@@ -1,9 +1,8 @@
1
1
  module Jarvis
2
2
  class Exception < StandardError
3
3
  end
4
- end
5
-
6
- module Jarvis
7
4
  class UnfitEnvironmentException < Exception
8
5
  end
6
+ class ThirdPartyAPIFailure < Exception
7
+ end
9
8
  end
data/lib/jarvis/server.rb CHANGED
@@ -18,6 +18,8 @@ module Jarvis
18
18
  json text: run_service(service)
19
19
  rescue Jarvis::UnfitEnvironmentException => e
20
20
  json text: "I'm really sorry, but that service needs to be configured"
21
+ rescue Jarvis::ThirdPartyAPIFailure
22
+ json text: "Most unfortunately, #{params["user_name"]}, that service is not working right now."
21
23
  rescue => e
22
24
  json text: "I'm sorry, Something went wrong: #{e}"
23
25
  end
@@ -6,3 +6,4 @@ require 'jarvis/services/giphy'
6
6
  require 'jarvis/services/i_heart_quotes'
7
7
  require 'jarvis/services/weather'
8
8
  require 'jarvis/services/tweet_that'
9
+ require 'jarvis/services/img_flip'
@@ -0,0 +1,69 @@
1
+ require 'jarvis/services/img_flip_memes/base_meme'
2
+ # Require All Supported Memes
3
+ Dir[File.dirname(__FILE__) + '/img_flip_memes/*.rb'].each {|file| require file }
4
+
5
+ class ImgFlip < Jarvis::Service
6
+ interpreter_pattern /you're gonna have a bad time|
7
+ and it'?s gone|
8
+ afraid to ask|
9
+ sudden clarity|
10
+ success kid|
11
+ not sure if|
12
+ picard|
13
+ one does not simply|
14
+ y u no|
15
+ what if i told you|
16
+ willy wonka|
17
+ overly attached girlfriend|
18
+ everywhere|
19
+ i don'?t always.+but when i do'?/xi
20
+
21
+ environment :imgflip_user, :imgflip_password
22
+ before_invoke :create_meme
23
+
24
+ attr_accessor :meme_link
25
+
26
+ def run
27
+ "Here you go, #{user_name}\n\n#{meme_link}"
28
+ end
29
+
30
+ private
31
+
32
+ def meme_class
33
+ case text
34
+ when /success kid/i
35
+ ImgFlipMemes::SuccessKid
36
+ when /afraid to ask/i
37
+ ImgFlipMemes::AfraidToAsk
38
+ when /and it'?s gone/i
39
+ ImgFlipMemes::AndItsGone
40
+ when /everywhere/i
41
+ ImgFlipMemes::Everywhere
42
+ when /you're gonna have a bad time/i
43
+ ImgFlipMemes::GonnaHaveABadTime
44
+ when /i don'?t always.+but when i do/i
45
+ ImgFlipMemes::MostInterestingMan
46
+ when /not sure if/i
47
+ ImgFlipMemes::NotSureIf
48
+ when /one does not simply/i
49
+ ImgFlipMemes::OneDoesNotSimply
50
+ when /overly attached girlfriend/i
51
+ ImgFlipMemes::OverlyAttachedGirlfriend
52
+ when /picard/i
53
+ ImgFlipMemes::Picard
54
+ when /sudden clarity/i
55
+ ImgFlipMemes::SuddenClarity
56
+ when /what if I told you/i
57
+ ImgFlipMemes::WhatIfIToldYou
58
+ when /willy wonka/i
59
+ ImgFlipMemes::WillyWonka
60
+ when /y u no/i
61
+ ImgFlipMemes::YUNo
62
+ end
63
+ end
64
+
65
+ def create_meme
66
+ self.meme_link = meme_class.new(message, imgflip_user, imgflip_password).create_meme
67
+ end
68
+
69
+ end
@@ -0,0 +1,17 @@
1
+ module ImgFlipMemes
2
+ class AfraidToAsk < BaseMeme
3
+ def template_id
4
+ 24557067
5
+ end
6
+
7
+ def text1
8
+ "And at this point, I'm afraid to ask"
9
+ end
10
+
11
+ def tokenize
12
+ captures = text.match(/#{trigger_word}(?<text0>.+),? and at this point/i)
13
+ self.captures[:text0] = captures[:text0]
14
+ true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module ImgFlipMemes
2
+ class AndItsGone < BaseMeme
3
+ def template_id
4
+ 766986
5
+ end
6
+
7
+ def text1
8
+ "Annnnnnnd it's gone"
9
+ end
10
+
11
+ def tokenize
12
+ captures = text.match(/#{trigger_word},? (?<text0>.+)and it'?s gone/i)
13
+ self.captures[:text0] = captures[:text0]
14
+ true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,57 @@
1
+ module ImgFlipMemes
2
+ class BaseMeme
3
+ attr_accessor :message, :imgflip_user, :imgflip_password, :text0, :text1, :captures
4
+ def initialize(message, imgflip_user, imgflip_password)
5
+ @message = message
6
+ @imgflip_user = imgflip_user
7
+ @imgflip_password = imgflip_password
8
+ @captures = {}
9
+ end
10
+
11
+ def tokenize
12
+ end
13
+
14
+ def template_id
15
+ end
16
+
17
+ def create_meme
18
+ tokenize
19
+ trim_captures
20
+ body = {
21
+ template_id: template_id,
22
+ username: imgflip_user,
23
+ password: imgflip_password,
24
+ text0: text0,
25
+ text1: text1
26
+ }
27
+ response = Jarvis.post(url, body: body).response
28
+ unless response["success"]
29
+ raise Jarvis::ThirdPartyAPIFailure
30
+ else
31
+ response["data"]["url"]
32
+ end
33
+ end
34
+
35
+ def url
36
+ "https://api.imgflip.com/caption_image"
37
+ end
38
+
39
+ def text0
40
+ captures[:text0]
41
+ end
42
+
43
+ def text1
44
+ captures[:text1]
45
+ end
46
+
47
+ def trim_captures
48
+ self.captures[:text0] = self.captures[:text0].strip if self.captures[:text0]
49
+ self.captures[:text1] = self.captures[:text1].strip if self.captures[:text1]
50
+ end
51
+
52
+ def method_missing(name, *args, &block)
53
+ message.public_send(name, *args, &block)
54
+ end
55
+
56
+ end
57
+ end
@@ -0,0 +1,15 @@
1
+ module ImgFlipMemes
2
+ class Everywhere < BaseMeme
3
+
4
+ def template_id
5
+ 347390
6
+ end
7
+
8
+ def tokenize
9
+ captures = text.match /#{trigger_word},? (?<text0>.+),(?<text1>.+ everywhere)?/i
10
+ self.captures[:text0], self.captures[:text1] = captures[:text0], captures[:text1]
11
+ true
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ module ImgFlipMemes
2
+ class GonnaHaveABadTime < BaseMeme
3
+ def template_id
4
+ 100951
5
+ end
6
+
7
+ def text1
8
+ "You're gonna have a bad time"
9
+ end
10
+
11
+ def tokenize
12
+ captures = text.match(/#{trigger_word},? (?<text0>.+),? you're gonna have a bad time/i)
13
+ self.captures[:text0] = captures[:text0]
14
+ true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ module ImgFlipMemes
2
+ class MostInterestingMan < BaseMeme
3
+ def template_id
4
+ 61532
5
+ end
6
+
7
+ def tokenize
8
+ captures = text.match(/#{trigger_word}.+(?<text0>i don'?t always.+), (?<text1>but when I do.+)/i)
9
+ self.captures[:text0], self.captures[:text1] = captures[:text0], captures[:text1]
10
+ true
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module ImgFlipMemes
2
+ class NotSureIf < BaseMeme
3
+ def template_id
4
+ 61520
5
+ end
6
+
7
+ def tokenize
8
+ captures = text.match(/#{trigger_word}.+(?<text0>not sure if.+),(?<text1>.+)/i)
9
+ self.captures[:text0], self.captures[:text1] = captures[:text0], captures[:text1]
10
+ true
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ module ImgFlipMemes
2
+ class OneDoesNotSimply < BaseMeme
3
+ def template_id
4
+ 61579
5
+ end
6
+
7
+ def text0
8
+ "One Does Not Simply"
9
+ end
10
+
11
+ def tokenize
12
+ captures = text.match(/one does not simply(?<text1>.+)/i)
13
+ self.captures[:text1] = captures[:text1]
14
+ true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ module ImgFlipMemes
2
+ class OverlyAttachedGirlfriend < BaseMeme
3
+ def template_id
4
+ 100952
5
+ end
6
+
7
+ def tokenize
8
+ captures = text.match(/overly attached girlfriend(?<text0>.[^,]+),?(?<text1>.[^,]+)?/i)
9
+ self.captures[:text0], self.captures[:text1] = captures[:text0], captures[:text1]
10
+ true
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module ImgFlipMemes
2
+ class Picard < BaseMeme
3
+ def template_id
4
+ 245898
5
+ end
6
+
7
+ def tokenize
8
+ captures = text.match(/picard(?<text0>.[^,]+),?(?<text1>.[^,]+)?/i)
9
+ self.captures[:text0], self.captures[:text1] = captures[:text0], captures[:text1]
10
+ true
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module ImgFlipMemes
2
+ class SuccessKid < BaseMeme
3
+ def template_id
4
+ 61544
5
+ end
6
+
7
+ def tokenize
8
+ captures = text.match(/success kid(?<text0>.[^,]+),?(?<text1>.[^,]+)?/i)
9
+ self.captures[:text0], self.captures[:text1] = captures[:text0], captures[:text1]
10
+ true
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module ImgFlipMemes
2
+ class SuddenClarity < BaseMeme
3
+ def template_id
4
+ 100948
5
+ end
6
+
7
+ def tokenize
8
+ captures = text.match(/sudden clarity(?<text0>.[^,]+),?(?<text1>.[^,]+)?/i)
9
+ self.captures[:text0], self.captures[:text1] = captures[:text0], captures[:text1]
10
+ true
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ module ImgFlipMemes
2
+ class WhatIfIToldYou < BaseMeme
3
+ def template_id
4
+ 100947
5
+ end
6
+
7
+ def text0
8
+ "What if I told you"
9
+ end
10
+
11
+ def tokenize
12
+ captures = text.match(/what if i told you(?<text1>.+)/i)
13
+ self.captures[:text1] = captures[:text1]
14
+ true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ module ImgFlipMemes
2
+ class WillyWonka < BaseMeme
3
+ def template_id
4
+ 61582
5
+ end
6
+
7
+ def tokenize
8
+ captures = text.match(/willy wonka(?<text0>.[^,]+),?(?<text1>.[^,]+)?/i)
9
+ self.captures[:text0], self.captures[:text1] = captures[:text0], captures[:text1]
10
+ true
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ module ImgFlipMemes
2
+ class YUNo < BaseMeme
3
+ def template_id
4
+ 61527
5
+ end
6
+
7
+ def text0
8
+ "Y U NO"
9
+ end
10
+
11
+ def tokenize
12
+ captures = text.match(/y u no(?<text1>.+)/i)
13
+ self.captures[:text1] = captures[:text1]
14
+ true
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module Jarvis
2
- VERSION = "0.0.7"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -0,0 +1,89 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe ImgFlip do
4
+ # before { stub_env("IMGFLIP_USER" => "imgflip_user", "IMGFLIP_PASSWORD" => "imgflip_password") }
5
+ describe "Success Kid", vcr: { cassette_name: 'img_flip_success_kid', :record => :new_episodes} do
6
+ let(:message) { Slack::Message.new(slack_outgoing_message(user_name: "DVG", text: "Jarvis, success kid hello, world")) }
7
+ subject { described_class.new message }
8
+ let(:meme_link) { "http://i.imgflip.com/hz9zo.jpg" }
9
+ it { expect(subject.invoke).to eq "Here you go, DVG\n\n#{meme_link}" }
10
+ end
11
+ describe "Afraid to Ask Andy", vcr: { cassette_name: 'img_flip_afraid_to_ask', :record => :new_episodes} do
12
+ let(:message) { Slack::Message.new(slack_outgoing_message(user_name: "DVG", text: "Jarvis, I'm not sure how to mock third party apis, and at this point, I'm afraid to ask")) }
13
+ subject { described_class.new message }
14
+ let(:meme_link) { "http://i.imgflip.com/hza6u.jpg" }
15
+ it { expect(subject.invoke).to eq "Here you go, DVG\n\n#{meme_link}" }
16
+ end
17
+ describe "And It's Gone", vcr: { cassette_name: 'img_flip_and_its_gone', :record => :new_episodes} do
18
+ let(:message) { Slack::Message.new(slack_outgoing_message(user_name: "DVG", text: "Jarvis, you have some services here, and it's gone")) }
19
+ subject { described_class.new message }
20
+ let(:meme_link) { "http://i.imgflip.com/hzqv7.jpg" }
21
+ it { expect(subject.invoke).to eq "Here you go, DVG\n\n#{meme_link}" }
22
+ end
23
+ describe "Everywhere", vcr: { cassette_name: 'img_flip_everywhere', :record => :new_episodes} do
24
+ let(:message) { Slack::Message.new(slack_outgoing_message(user_name: "DVG", text: "Jarvis, tests, tests everywhere")) }
25
+ subject { described_class.new message }
26
+ let(:meme_link) { "http://i.imgflip.com/hzr5m.jpg" }
27
+ it { expect(subject.invoke).to eq "Here you go, DVG\n\n#{meme_link}" }
28
+ end
29
+ describe "Everywhere", vcr: { cassette_name: 'img_flip_gonna_have_a_bad_time', :record => :new_episodes} do
30
+ let(:message) { Slack::Message.new(slack_outgoing_message(user_name: "DVG", text: "Jarvis, if you mock when you should use a real object, you're gonna have a bad time")) }
31
+ subject { described_class.new message }
32
+ let(:meme_link) { "http://i.imgflip.com/hzrd1.jpg" }
33
+ it { expect(subject.invoke).to eq "Here you go, DVG\n\n#{meme_link}" }
34
+ end
35
+ describe "Most Interesting Man", vcr: { cassette_name: 'img_flip_most_interesting_man', :record => :new_episodes} do
36
+ let(:message) { Slack::Message.new(slack_outgoing_message(user_name: "DVG", text: "Jarvis, I don't always ci my code, but when I do, I do it on Travis")) }
37
+ subject { described_class.new message }
38
+ let(:meme_link) { "http://i.imgflip.com/hzrnq.jpg" }
39
+ it { expect(subject.invoke).to eq "Here you go, DVG\n\n#{meme_link}" }
40
+ end
41
+ describe "Not Sure If", vcr: { cassette_name: 'img_flip_not_sure_if', :record => :new_episodes} do
42
+ let(:message) { Slack::Message.new(slack_outgoing_message(user_name: "DVG", text: "Jarvis, Not sure if this test is going to pass, or if it's gonna break the build")) }
43
+ subject { described_class.new message }
44
+ let(:meme_link) { "http://i.imgflip.com/hzrz0.jpg" }
45
+ it { expect(subject.invoke).to eq "Here you go, DVG\n\n#{meme_link}" }
46
+ end
47
+ describe "One Does Not Simply", vcr: { cassette_name: 'img_flip_one_does_not_simply', :record => :new_episodes} do
48
+ let(:message) { Slack::Message.new(slack_outgoing_message(user_name: "DVG", text: "Jarvis, one does not simply write rspecs")) }
49
+ subject { described_class.new message }
50
+ let(:meme_link) { "http://i.imgflip.com/hzs4e.jpg" }
51
+ it { expect(subject.invoke).to eq "Here you go, DVG\n\n#{meme_link}" }
52
+ end
53
+ describe "Overly Attached Girlfriend", vcr: { cassette_name: 'img_flip_overly_attached_girlfriend', :record => :new_episodes} do
54
+ let(:message) { Slack::Message.new(slack_outgoing_message(user_name: "DVG", text: "Jarvis, overly attached girlfriend I looked at your slack channel, who is this jarvis you keep talking to?")) }
55
+ subject { described_class.new message }
56
+ let(:meme_link) { "http://i.imgflip.com/hzsbu.jpg" }
57
+ it { expect(subject.invoke).to eq "Here you go, DVG\n\n#{meme_link}" }
58
+ end
59
+ describe "Picard", vcr: { cassette_name: 'img_flip_picard', :record => :new_episodes} do
60
+ let(:message) { Slack::Message.new(slack_outgoing_message(user_name: "DVG", text: "Jarvis, picard why the fuck, did you make so many memes?")) }
61
+ subject { described_class.new message }
62
+ let(:meme_link) { "http://i.imgflip.com/hzsgd.jpg" }
63
+ it { expect(subject.invoke).to eq "Here you go, DVG\n\n#{meme_link}" }
64
+ end
65
+ describe "Sudden Clarity", vcr: { cassette_name: 'img_flip_sudden_clarity', :record => :new_episodes} do
66
+ let(:message) { Slack::Message.new(slack_outgoing_message(user_name: "DVG", text: "Jarvis, sudden clarity can't think of, anything clever right now")) }
67
+ subject { described_class.new message }
68
+ let(:meme_link) { "http://i.imgflip.com/hzspk.jpg" }
69
+ it { expect(subject.invoke).to eq "Here you go, DVG\n\n#{meme_link}" }
70
+ end
71
+ describe "What if I Told You", vcr: { cassette_name: 'img_flip_what_if_I_told_you', :record => :new_episodes} do
72
+ let(:message) { Slack::Message.new(slack_outgoing_message(user_name: "DVG", text: "Jarvis, what if I told you Jarvis is the best bot ever?")) }
73
+ subject { described_class.new message }
74
+ let(:meme_link) { "http://i.imgflip.com/hzsv9.jpg" }
75
+ it { expect(subject.invoke).to eq "Here you go, DVG\n\n#{meme_link}" }
76
+ end
77
+ describe "Willy Wonka", vcr: { cassette_name: 'img_flip_willy_wonka', :record => :new_episodes} do
78
+ let(:message) { Slack::Message.new(slack_outgoing_message(user_name: "DVG", text: "Jarvis willy wonka hello, world")) }
79
+ subject { described_class.new message }
80
+ let(:meme_link) { "http://i.imgflip.com/hzt18.jpg" }
81
+ it { expect(subject.invoke).to eq "Here you go, DVG\n\n#{meme_link}" }
82
+ end
83
+ describe "Y U No", vcr: { cassette_name: 'img_flip_y_u_no', :record => :new_episodes} do
84
+ let(:message) { Slack::Message.new(slack_outgoing_message(user_name: "DVG", text: "Jarvis y u no sql")) }
85
+ subject { described_class.new message }
86
+ let(:meme_link) { "http://i.imgflip.com/hzt5g.jpg" }
87
+ it { expect(subject.invoke).to eq "Here you go, DVG\n\n#{meme_link}" }
88
+ end
89
+ end