Sha256: a7dea8669a3aeaf81305bc9eb80a2b728e12dd0aaf14b56550d6490ad48b4988
Contents?: true
Size: 908 Bytes
Versions: 164
Compression:
Stored size: 908 Bytes
Contents
describe ActionSubscriber::Middleware::Decoder do include_context 'action subscriber middleware env' subject { described_class.new(app) } it_behaves_like 'an action subscriber middleware' let(:env) { ActionSubscriber::Middleware::Env.new(UserSubscriber, encoded_payload, message_properties) } let(:encoded_payload) { JSON.generate(payload) } let(:payload) { {"ohai" => "GUYZ"} } context "when the content type has an associated decoder" do before { message_properties[:content_type] = "application/json"} it "decodes the payload" do subject.call(env) expect(env.payload).to eq(payload) end end context "when the content type does not have an associated decoder" do before { message_properties[:content_type] = "application/foo"} it "uses the payload as-is" do subject.call(env) expect(env.payload).to eq(encoded_payload) end end end
Version data entries
164 entries across 164 versions & 1 rubygems