diff options
| author | Nuno Santos <nsantos@apache.org> | 2012-01-17 19:18:44 +0000 |
|---|---|---|
| committer | Nuno Santos <nsantos@apache.org> | 2012-01-17 19:18:44 +0000 |
| commit | cf2111567172adc407201b038d6033d1aa865938 (patch) | |
| tree | 26b385b827c54fd3217224b2d21cafb94d046ecd /cpp/bindings/qpid/ruby | |
| parent | d091d387fc5dd5432146d6542822a47f4fa403b5 (diff) | |
| download | qpid-python-cf2111567172adc407201b038d6033d1aa865938.tar.gz | |
QPID-3754: Takes the Ruby bindings to 100% unit test coverage (patch from Darryl Pierce)
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1232545 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/bindings/qpid/ruby')
| -rw-r--r-- | cpp/bindings/qpid/ruby/lib/qpid/encoding.rb | 2 | ||||
| -rw-r--r-- | cpp/bindings/qpid/ruby/spec/qpid/address_spec.rb | 9 | ||||
| -rw-r--r-- | cpp/bindings/qpid/ruby/spec/qpid/encoding_spec.rb | 63 |
3 files changed, 74 insertions, 0 deletions
diff --git a/cpp/bindings/qpid/ruby/lib/qpid/encoding.rb b/cpp/bindings/qpid/ruby/lib/qpid/encoding.rb index c8b843b597..7b9130156d 100644 --- a/cpp/bindings/qpid/ruby/lib/qpid/encoding.rb +++ b/cpp/bindings/qpid/ruby/lib/qpid/encoding.rb @@ -48,6 +48,8 @@ module Qpid when "amqp/map": Cqpid.decodeMap message.message_impl when "amqp/list": Cqpid.decodeList message.message_impl end + + message.content end end diff --git a/cpp/bindings/qpid/ruby/spec/qpid/address_spec.rb b/cpp/bindings/qpid/ruby/spec/qpid/address_spec.rb index e4672e4e47..784fb6fe77 100644 --- a/cpp/bindings/qpid/ruby/spec/qpid/address_spec.rb +++ b/cpp/bindings/qpid/ruby/spec/qpid/address_spec.rb @@ -71,6 +71,15 @@ module Qpid create.should == "always" end + it "can return a string representation" do + address = Qpid::Messaging::Address.new "foo", "bar", :create => :always, :link => :durable + result = address.to_s + + result.should =~ /foo\/bar/ + result.should =~ /create:always/ + result.should =~ /link:durable/ + end + end end diff --git a/cpp/bindings/qpid/ruby/spec/qpid/encoding_spec.rb b/cpp/bindings/qpid/ruby/spec/qpid/encoding_spec.rb new file mode 100644 index 0000000000..58b8447278 --- /dev/null +++ b/cpp/bindings/qpid/ruby/spec/qpid/encoding_spec.rb @@ -0,0 +1,63 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +require 'spec_helper' + +module Qpid + + module Messaging + + describe "encoding" do + end + + describe "decoding" do + + before(:each) do + @message = Qpid::Messaging::Message.new + end + + it "can decode a message's text content" do + @message.content = "This is an unencoded message." + + content = Qpid::Messaging.decode @message + + content.should == "This is an unencoded message." + end + + it "can decode a message's list content" do + @message.content = ["this", "that"] + + content = Qpid::Messaging.decode @message + + content.should == ["this", "that"] + end + + it "can decode a message's map content" do + @message.content = {"this" => "that"} + + content = Qpid::Messaging.decode @message + + content.should == {"this" => "that"} + end + + end + + end + +end |
