Sha256: b7ba39b3f270933765097115b44f08d04cd6d800022e42e7cde364854558d148

Contents?: true

Size: 1008 Bytes

Versions: 2

Compression:

Stored size: 1008 Bytes

Contents

require 'spec_helper'

describe Ruboty::Handlers::HibariBento do
  describe '#pull' do
    let(:pull) { double('Pull') }
    let(:robot) { Ruboty::Robot.new }
    let(:sender) { 'user1' }
    let(:channel) { '#general' }

    shared_examples_for 'common pull' do
      it { is_expected.to receive(:call).with(no_args) }
    end

    before do
      allow(Ruboty::HibariBento::Actions::Pull).to receive(:new).and_return(pull)
      stub_const('ENV', { 'HIBARI_BENTO_FACEBOOK_ACCESS_TOKEN' => 'token'})
    end

    subject { pull }

    %w(pull fetch show).each do |method|
      context %Q(given "bento #{method}") do
        after do
          robot.receive(body: "@ruboty bento #{method}", from: sender, to: channel)
        end
        it_behaves_like 'common pull'
      end

      context %Q(given "bento #{method} 1") do
        after do
          robot.receive(body: "@ruboty bento #{method} 1", from: sender, to: channel)
        end
        it_behaves_like 'common pull'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruboty-hibari_bento-0.0.5 spec/ruboty/handlers/hibari_bento_spec.rb
ruboty-hibari_bento-0.0.4 spec/ruboty/handlers/hibari_bento_spec.rb