Sha256: e4dd2f4389588e0eaf00d7574ffb58e2df656be9fdfa73bc7277af9d196c9d65
Contents?: true
Size: 1022 Bytes
Versions: 2
Compression:
Stored size: 1022 Bytes
Contents
# -*- coding: utf-8 -*- require 'spec_helper' require 'thor/core_ext/hash_with_indifferent_access' describe Magellan::Cli::Messaging::Mqtt do let(:cmd){ Magellan::Cli::Messaging::Mqtt.new } let(:core){ double(:core) } before{ allow(cmd).to receive(:core).and_return(core) } let(:success_res){ double(:res, code: 200, body: "SUCCESS!\n") } let(:failure_res){ double(:res, code: 401, body: "NOT FOUND!\n") } describe :pub do it do expect(core).to receive(:publish).with("foo.bar", "payload") cmd.pub("foo.bar", "payload") end end describe :get do it "without argument" do expect(core).to receive(:get_message) cmd.get end it "with nil" do expect(core).to receive(:get_message).with(nil) cmd.get(nil) end it "with blank string" do expect(core).to receive(:get_message).with("") cmd.get("") end it "with topic" do expect(core).to receive(:get_message).with("foo.bar") cmd.get("foo.bar") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
magellan-cli-0.5.4 | spec/magellan/cli/messaging/mqtt_spec.rb |
magellan-cli-0.5.3 | spec/magellan/cli/messaging/mqtt_spec.rb |