Sha256: 9d10cf45314e0d04184355c6342bf015e243a9b7a8be05a3c52dfdeb97fe8638
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
require "spec_helper" describe Lita::Handlers::Consul, lita_handler: true do describe 'lita routes' do it { is_expected.to route_command('consul get mykey').to(:consul_get) } end before do allow_any_instance_of(Faraday::Connection).to receive(:get).and_return(response) end let(:response) { double("Faraday::Response") } let(:single_key_response) { %{ [ { "CreateIndex":67, "ModifyIndex":67, "LockIndex":0, "Key":"mykey", "Flags":0, "Value":"dGVzdGluZw==" } ] } } let(:null_value_response) { %{ [ { "CreateIndex":67, "ModifyIndex":67, "LockIndex":0, "Key":"mykey", "Flags":0, "Value":null } ] } } describe '#consul get' do it 'return value for key' do allow(response).to receive(:body).and_return(single_key_response) send_command('consul get mykey') expect(replies.last).to eq("mykey = testing") end it 'return null value for key' do allow(response).to receive(:body).and_return(null_value_response) send_command('consul get mykey') expect(replies.last).to eq("mykey = null") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lita-consul-0.0.1 | spec/lita/handlers/consul_spec.rb |