Sha256: 56eb9a89e2e23e95b8503865b4332aff8eecaf89ab3f72180bf38265ac150727
Contents?: true
Size: 1.71 KB
Versions: 1
Compression:
Stored size: 1.71 KB
Contents
require "spec_helper" describe Lita::Handlers::ImgflipMemes, lita_handler: true do let(:robot) { Lita::Robot.new(registry) } let(:jpeg_url_match) { /http.*\.jpg/i } let(:aliens_template_id) { 101470 } subject { described_class.new(robot) } describe 'routes' do it { is_expected.to route("Lita aliens chat bots") } end describe ':pull_image' do it 'returns a jpeg url' do result = subject.pull_image(aliens_template_id, 'hello', 'world') expect(result).to match(jpeg_url_match) end end describe ':make_meme' do after { send_command "aliens chat bots" } it 'responds with an image URL' do send_message "Lita aliens chat bots" expect(replies.last).to match(jpeg_url_match) end it 'can handle two-line inputs' do send_message 'lita one does not simply walk into mordor' expect(replies.last).to match(jpeg_url_match) end end describe ':extract_meme_text' do let(:matchers) { described_class.registered_templates } it 'can properly match no-first-line inputs' do matcher = matchers.select { |t| t.fetch(:template_id) == 101470 }.first pattern = matcher.fetch(:pattern) match_data = pattern.match 'aliens chat bots' result = subject.extract_meme_text match_data expect(result).to eql(['', 'chat bots']) end it 'can properly capture meme text that is part of the trigger' do matcher = matchers.select { |t| t.fetch(:template_id) == 61579 }.first pattern = matcher.fetch(:pattern) match_data = pattern.match 'one does not simply walk into mordor' result = subject.extract_meme_text match_data expect(result).to eql(['one does not simply', 'walk into mordor']) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lita-imgflip-memes-1.1.1 | spec/lita/handlers/imgflip_memes_spec.rb |