Sha256: f3d6bae0f319511a3e1023853a5d969c2d403f65f4dcbeeb7aaacb164f5628ec
Contents?: true
Size: 941 Bytes
Versions: 2
Compression:
Stored size: 941 Bytes
Contents
module GooglePubsubEnhancer::Spec module ClassMethods def __setup_pubsub! let(:messages) { [] } let(:pubsub) {double "pubsub"} let(:publisher) { double "publisher"} let(:subscription) { double 'subscription'} before do ENV['PUBSUB_KEYFILE_JSON'] = JSON.dump(project_id: 'cica') allow(Google::Cloud::Pubsub).to receive(:new).and_return(pubsub) allow(pubsub).to receive(:publish).and_yield(publisher) allow(pubsub).to receive(:subscription).and_return subscription allow(subscription).to receive(:pull).and_return(messages.map { |m| Google::Cloud::Pubsub::Message.new(m.to_s)},nil) allow(publisher).to receive(:publish) allow(subscription).to receive(:acknowledge) end after do ENV.delete 'PUBSUB_KEYFILE_JSON' end end end def self.included(klass) klass.extend ClassMethods klass.__setup_pubsub! end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
google-pubsub-enhancer-0.5.2 | lib/google_pubsub_enhancer/spec.rb |
google-pubsub-enhancer-0.5.1 | lib/google_pubsub_enhancer/spec.rb |