Sha256: 9e3c683bb524f83c648a7a0092b92f5333a957e89a92b006c2f4e0b670d4d222

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

RSpec.describe Slack::Web::Api::Endpoints::Dialog do
  let(:client) { Slack::Web::Client.new }
  context 'dialog_open' do
    it 'automatically converts dialog into JSON' do
      expect(client).to receive(:post).with(
        'dialog.open',
        trigger_id: '12345.98765.abcd2358fdea',
        dialog: '[]'
      )
      client.dialog_open(trigger_id: '12345.98765.abcd2358fdea', dialog: [])
    end

    context 'arguments' do
      it 'requires dialog' do
        expect { client.dialog_open(trigger_id: '123') }.to raise_error ArgumentError, /Required arguments :dialog missing/
      end
      it 'requires trigger_id' do
        expect { client.dialog_open(dialog: []) }.to raise_error ArgumentError, /Required arguments :trigger_id missing/
      end
      it 'likes both dialog and trigger_id' do
        expect(client).to receive(:post).with('dialog.open', hash_including(trigger_id: '123', dialog: '[]'))
        expect { client.dialog_open(dialog: [], trigger_id: '123') }.to_not raise_error
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
slack-ruby-client-0.14.4 spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb
slack-ruby-client-0.14.3 spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb
slack-ruby-client-0.14.2 spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb
slack-ruby-client-0.14.1 spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb
slack-ruby-client-0.14.0 spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb
slack-ruby-client-0.13.1 spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb
slack-ruby-client-0.13.0 spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb
slack-ruby-client-0.12.0 spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb
slack-ruby-client-0.11.1 spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb
slack-ruby-client-0.11.0 spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb