Sha256: 6bda7c7f03437cb0c61cdb4cba729aa5360f43f3a7acf445b21c107377525599
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
require 'spec_helper' require 'routemaster/cli/top_level' require 'webmock/rspec' describe Routemaster::CLI::Sub, type: :cli do before { allow_bus_pulse 'bus.dev', 's3cr3t' } describe 'add' do context 'with correct arguments' do let(:argv) { %w[sub add https://my-service.dev cats dogs -b bus.dev -t s3cr3t] } it { expect(client).to receive(:subscribe).with(topics: %w[cats dogs], callback: 'https://my-service.dev', uuid: 's3cr3t') perform } end end describe 'del' do context 'with a list of topics' do let(:argv) { %w[sub del cats dogs -b bus.dev -t s3cr3t] } it { expect(client).to receive(:unsubscribe).with('cats', 'dogs') perform } end context 'without arguments' do let(:argv) { %w[sub del -b bus.dev -t s3cr3t] } it { expect(client).to receive(:unsubscribe_all).with(no_args) perform } end end describe 'list' do context 'with correct arguments' do let(:argv) { %w[sub list -b bus.dev -t s3cr3t] } before { allow(client).to receive(:monitor_subscriptions).and_return([ Routemaster::Client::Subscription.new( 'subscriber' => 'service--f000-b44r-b44r', 'callback' => 'https://serviced.dev', 'topics' => %w[cats dogs], 'events' => { 'queued' => 1234 }) ]) } it { expect(client).to receive(:monitor_subscriptions).with(no_args) perform } it { expect { perform }.to change { stdout.string }.to a_string_matching(/service--f000-b44r-b44r/) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
routemaster-client-3.1.2 | spec/cli/sub_spec.rb |