You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by mc...@apache.org on 2014/12/08 16:00:15 UTC
[1/4] qpid-proton git commit: PROTON-755: Changed how the Data rspec
test sets a single random character.
Repository: qpid-proton
Updated Branches:
refs/heads/master 1dc43c6c3 -> 4d2a6fd01
PROTON-755: Changed how the Data rspec test sets a single random character.
The new method is portable across versions of Ruby.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/4d2a6fd0
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/4d2a6fd0
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/4d2a6fd0
Branch: refs/heads/master
Commit: 4d2a6fd015527404eb4c571746da95cc989b08b1
Parents: 9cfd9bb
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Tue Dec 2 08:47:58 2014 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Mon Dec 8 09:38:01 2014 -0500
----------------------------------------------------------------------
proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4d2a6fd0/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb b/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb
index e760cbe..2e10b8a 100644
--- a/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb
+++ b/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb
@@ -171,7 +171,9 @@ module Qpid
end
it "can hold a character" do
- value = rand(256).chr.ord
+ source = random_string(256)
+ index = rand(source.length)
+ value = source[index,1].bytes.to_a[0]
@data.char = value
expect(@data.char).to eq(value)
end
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[3/4] qpid-proton git commit: PROTON-755: Add SecureRandom for use by
Ruby 1.8 tests
Posted by mc...@apache.org.
PROTON-755: Add SecureRandom for use by Ruby 1.8 tests
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/9cfd9bb8
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/9cfd9bb8
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/9cfd9bb8
Branch: refs/heads/master
Commit: 9cfd9bb818acecde336e8bc40347ff4aab79a3bb
Parents: 60cd60a
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Mon Dec 1 15:22:51 2014 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Mon Dec 8 09:38:01 2014 -0500
----------------------------------------------------------------------
proton-c/bindings/ruby/spec/spec_helper.rb | 34 +++++++++++++++++++++++++
1 file changed, 34 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9cfd9bb8/proton-c/bindings/ruby/spec/spec_helper.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/spec_helper.rb b/proton-c/bindings/ruby/spec/spec_helper.rb
index 6c2d6fa..aa1e346 100644
--- a/proton-c/bindings/ruby/spec/spec_helper.rb
+++ b/proton-c/bindings/ruby/spec/spec_helper.rb
@@ -33,6 +33,40 @@ end
require "securerandom"
require "qpid_proton"
+# in Ruby 1.8 there is no SecureRandom module
+if RUBY_VERSION < "1.9"
+ module SecureRandom
+ class << self
+ def method_missing(method_sym, *arguments, &block)
+ case method_sym
+ when :urlsafe_base64
+ r19_urlsafe_base64(*arguments)
+ when :uuid
+ r19_uuid(*arguments)
+ else
+ super
+ end
+ end
+
+ private
+ def r19_urlsafe_base64(n=nil, padding=false)
+ s = [random_bytes(n)].pack("m*")
+ s.delete!("\n")
+ s.tr!("+/", "-_")
+ s.delete!("=") if !padding
+ s
+ end
+
+ def r19_uuid
+ ary = random_bytes(16).unpack("NnnnnN")
+ ary[2] = (ary[2] & 0x0fff) | 0x4000
+ ary[3] = (ary[3] & 0x3fff) | 0x8000
+ "%08x-%04x-%04x-%04x-%04x%08x" % ary
+ end
+ end
+ end
+end
+
# Generates a random string of the specified length
def random_string(length = 8)
(0...length).map{65.+(rand(25)).chr}.join
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/4] qpid-proton git commit: PROTON-755: Updated rspec tests to use
the newer expect syntax
Posted by mc...@apache.org.
PROTON-755: Updated rspec tests to use the newer expect syntax
Rspec is moving away from monkey patching objects, and this new syntax
reflects that change. Updated the rspec tests to work with Rspec 2.4 and
3.x properly.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/60cd60a5
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/60cd60a5
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/60cd60a5
Branch: refs/heads/master
Commit: 60cd60a5626c05b3e3e6a328ab30cccecce7cedd
Parents: e763ef4
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Mon Dec 1 10:54:41 2014 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Mon Dec 8 09:38:01 2014 -0500
----------------------------------------------------------------------
.../ruby/spec/qpid/proton/array_spec.rb | 30 +--
.../bindings/ruby/spec/qpid/proton/data_spec.rb | 108 ++++-----
.../bindings/ruby/spec/qpid/proton/hash_spec.rb | 3 +-
.../ruby/spec/qpid/proton/message_spec.rb | 218 +++++++++----------
.../ruby/spec/qpid/proton/messenger_spec.rb | 66 +++---
5 files changed, 212 insertions(+), 213 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/60cd60a5/proton-c/bindings/ruby/spec/qpid/proton/array_spec.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/qpid/proton/array_spec.rb b/proton-c/bindings/ruby/spec/qpid/proton/array_spec.rb
index cc03945..3af6907 100644
--- a/proton-c/bindings/ruby/spec/qpid/proton/array_spec.rb
+++ b/proton-c/bindings/ruby/spec/qpid/proton/array_spec.rb
@@ -32,10 +32,10 @@ describe "The extended array type" do
it "can be created like a normal array" do
value = []
- value.should respond_to :proton_put
- value.should respond_to :proton_array_header
- value.class.should respond_to :proton_get
- value.should respond_to :proton_described?
+ expect(value).to respond_to(:proton_put)
+ expect(value).to respond_to(:proton_array_header)
+ expect(value.class).to respond_to(:proton_get)
+ expect(value).to respond_to :proton_described?
end
it "raises an error when putting into a nil Data object" do
@@ -66,19 +66,19 @@ describe "The extended array type" do
end
it "does not have an array header when it's a simple list" do
- @list.proton_described?.should be_false
+ expect(@list.proton_described?).to eq(false)
end
it "can be put into a Data object as a list" do
@list.proton_put(@data)
result = Array.proton_get(@data)
- result.should =~ @list
- result.proton_array_header.should be_nil
+ expect(result).to match_array(@list)
+ expect(result.proton_array_header).to eq(nil)
end
it "has an array header when it's an AMQP array" do
- @undescribed.proton_array_header.should_not be_nil
- @described.proton_array_header.should_not be_nil
+ expect(@undescribed.proton_array_header).not_to be_nil
+ expect(@described.proton_array_header).not_to be_nil
end
it "raises an error when the elements of an Array are dissimilar and is put into a Data object" do
@@ -96,9 +96,9 @@ describe "The extended array type" do
result = Array.proton_get(@data)
be_close_array(@undescribed, result)
- result.proton_array_header.should_not be_nil
- result.proton_array_header.should == @undescribed.proton_array_header
- result.proton_array_header.described?.should be_false
+ expect(result.proton_array_header).not_to be_nil
+ expect(result.proton_array_header).to eq(@undescribed.proton_array_header)
+ expect(result.proton_array_header.described?).to eq(false)
end
it "can be put into a Data object as a described array" do
@@ -106,9 +106,9 @@ describe "The extended array type" do
result = Array.proton_get(@data)
be_close_array(@described, result)
- result.proton_array_header.should_not be_nil
- result.proton_array_header.should == @described.proton_array_header
- result.proton_array_header.described?.should be_true
+ expect(result.proton_array_header).not_to be_nil
+ expect(result.proton_array_header).to eq(@described.proton_array_header)
+ expect(result.proton_array_header.described?).to eq(true)
end
end
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/60cd60a5/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb b/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb
index bdbd25f..e760cbe 100644
--- a/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb
+++ b/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb
@@ -30,22 +30,22 @@ module Qpid
end
it "can be initialized" do
- @data.should_not be_nil
+ expect(@data).not_to be_nil
end
it "can hold a null" do
@data.null
- @data.null?.should be_true
+ expect(@data.null?).to eq(true)
end
it "can hold a true boolean" do
@data.bool = true
- @data.bool.should be_true
+ expect(@data.bool).to eq(true)
end
it "can hold a false boolean" do
@data.bool = false
- @data.bool.should_not be_true
+ expect(@data.bool).to eq(false)
end
it "raises an error on a negative ubyte" do
@@ -63,19 +63,19 @@ module Qpid
it "can hold an unsigned byte" do
value = rand(255)
@data.ubyte = value
- @data.ubyte.should == value
+ expect(@data.ubyte).to eq(value)
end
it "can hold a byte" do
value = rand(128)
@data.byte = value
- @data.byte.should == value
+ expect(@data.byte).to eq(value)
end
it "can hold a negative byte" do
value = 0 - (rand(126) + 1)
@data.byte = value
- @data.byte.should == value
+ expect(@data.byte).to eq(value)
end
it "raises an error on a negative ushort" do
@@ -92,13 +92,13 @@ module Qpid
it "can hold a zero unsigned short" do
@data.ushort = 0
- @data.ushort.should == 0
+ expect(@data.ushort).to eq(0)
end
it "can hold an unsigned short" do
value = rand(2**15) + 1
@data.ushort = value
- @data.ushort.should == value
+ expect(@data.ushort).to eq(value)
end
it "raises an error on a nil short" do
@@ -110,18 +110,18 @@ module Qpid
it "can hold a short" do
value = rand(2**15) + 1
@data.short = value
- @data.short.should == value
+ expect(@data.short).to eq(value)
end
it "can hold a zero short" do
@data.short = 0
- @data.short.should == 0
+ expect(@data.short).to eq(0)
end
it "can hold a negative short" do
value = (0 - (rand(2**15) + 1))
@data.short = value
- @data.short.should == value
+ expect(@data.short).to eq(value)
end
it "raises an error on a nil uint" do
@@ -139,12 +139,12 @@ module Qpid
it "can hold an unsigned integer" do
value = rand(2**32) + 1
@data.uint = value
- @data.uint.should == value
+ expect(@data.uint).to eq(value)
end
it "can hold a zero unsigned integer" do
@data.uint = 0
- @data.uint.should == 0
+ expect(@data.uint).to eq(0)
end
it "raise an error on a null integer" do
@@ -156,12 +156,12 @@ module Qpid
it "can hold an integer" do
value = rand(2**31) + 1
@data.int = value
- @data.int.should == value
+ expect(@data.int).to eq(value)
end
it "can hold zero as an integer" do
@data.int = 0
- @data.int.should == 0
+ expect(@data.int).to eq(0)
end
it "raises an error on a null character" do
@@ -173,7 +173,7 @@ module Qpid
it "can hold a character" do
value = rand(256).chr.ord
@data.char = value
- @data.char.should == value
+ expect(@data.char).to eq(value)
end
it "raises an error on a null ulong" do
@@ -190,13 +190,13 @@ module Qpid
it "can have a zero unsigned long" do
@data.ulong = 0
- @data.ulong.should == 0
+ expect(@data.ulong).to eq(0)
end
it "can hold an unsigned long" do
value = rand(2**63) + 1
@data.ulong = value
- @data.ulong.should == value
+ expect(@data.ulong).to eq(value)
end
it "raises an error on a null long" do
@@ -207,13 +207,13 @@ module Qpid
it "can have a zero long" do
@data.long = 0
- @data.long.should == 0
+ expect(@data.long).to eq(0)
end
it "can hold a long" do
value = rand(2**63) + 1
@data.long = value
- @data.long.should == value
+ expect(@data.long).to eq(value)
end
it "raise an error on a null timestamp" do
@@ -225,18 +225,18 @@ module Qpid
it "can handle a negative timestamp" do
last_year = Time.now - (60*60*24*365)
@data.timestamp = last_year
- @data.timestamp.should == last_year.to_i
+ expect(@data.timestamp).to eq(last_year.to_i)
end
it "can handle a zero timestamp" do
@data.timestamp = 0
- @data.timestamp.should == 0
+ expect(@data.timestamp).to eq(0)
end
it "can hold a timestamp" do
next_year = Time.now + (60*60*24*365)
@data.timestamp = next_year
- @data.timestamp.should == next_year.to_i
+ expect(@data.timestamp).to eq(next_year.to_i)
end
it "raises an error on a null float" do
@@ -248,18 +248,18 @@ module Qpid
it "can hold a negative float" do
value = 0.0 - (1.0 + rand(2.0**15)).to_f
@data.float = value
- @data.float.should == value
+ expect(@data.float).to eq(value)
end
it "can hold a zero float" do
@data.float = 0.0
- @data.float.should == 0.0
+ expect(@data.float).to eq(0.0)
end
it "can hold a float" do
value = (1.0 + rand(2.0**15)).to_f
@data.float = value
- @data.float.should == value
+ expect(@data.float).to eq(value)
end
it "raise an error on a null double" do
@@ -271,18 +271,18 @@ module Qpid
it "can hold a negative double" do
value = 0.0 - (1.0 + rand(2.0**31)).to_f
@data.double = value
- @data.double.should == value
+ expect(@data.double).to eq(value)
end
it "can hold a zero double" do
@data.double = 0.0
- @data.double.should == 0.0
+ expect(@data.double).to eq(0.0)
end
it "can hold a double" do
value = (1.0 + rand(2.0**31)).to_f
@data.double = value
- @data.double.should == value
+ expect(@data.double).to eq(value)
end
it "raises an error on a null decimal32" do
@@ -293,13 +293,13 @@ module Qpid
it "can hold a zero decimal32" do
@data.decimal32 = 0
- @data.decimal32.should == 0
+ expect(@data.decimal32).to eq(0)
end
it "can hold a decimal32" do
value = 1 + rand(2**31)
@data.decimal32 = value
- @data.decimal32.should == value
+ expect(@data.decimal32).to eq(value)
end
it "raises an error on a null decimal64" do
@@ -310,13 +310,13 @@ module Qpid
it "can hold a zero decimal64" do
@data.decimal64 = 0
- @data.decimal64.should == 0
+ expect(@data.decimal64).to eq(0)
end
it "can hold a decimal64" do
value = 1 + rand(2**63)
@data.decimal64 = value
- @data.decimal64.should == value
+ expect(@data.decimal64).to eq(value)
end
it "raises an error on a null decimal128" do
@@ -327,13 +327,13 @@ module Qpid
it "can hold a zero decimal128" do
@data.decimal128 = 0
- @data.decimal128.should == 0
+ expect(@data.decimal128).to eq(0)
end
it "can hold a decimal128" do
value = rand(2**127)
@data.decimal128 = value
- @data.decimal128.should == value
+ expect(@data.decimal128).to eq(value)
end
it "raises an error on a null UUID" do
@@ -350,46 +350,46 @@ module Qpid
it "can set a UUID from an integer value" do
@data.uuid = 336307859334295828133695192821923655679
- @data.uuid.should == "fd0289a5-8eec-4a08-9283-81d02c9d2fff"
+ expect(@data.uuid).to eq("fd0289a5-8eec-4a08-9283-81d02c9d2fff")
end
it "can hold a UUID" do
value = "fd0289a5-8eec-4a08-9283-81d02c9d2fff"
@data.uuid = value
- @data.uuid.should == value
+ expect(@data.uuid).to eq(value)
end
it "can hold a null binary" do
@data.binary = nil
- @data.binary.should == ""
+ expect(@data.binary).to eq("")
end
it "can hold a binary" do
value = random_string(128)
@data.binary = value
- @data.binary.should == value
+ expect(@data.binary).to eq(value)
end
it "can hold a null string" do
@data.string = nil
- @data.string.should == ""
+ expect(@data.string).to eq("")
end
it "can hold a string" do
value = random_string(128)
@data.string = value
- @data.string.should == value
+ expect(@data.string).to eq(value)
end
it "can hold a null symbol" do
@data.symbol = nil
- @data.symbol.should == ""
+ expect(@data.symbol).to eq("")
end
it "can hold a symbol" do
value = random_string(128)
@data.symbol = value
- @data.symbol.should == value
+ expect(@data.symbol).to eq(value)
end
it "can hold a described value" do
@@ -401,12 +401,12 @@ module Qpid
@data.string = value
@data.exit
- @data.described?.should be_true
+ expect(@data.described?).to eq(true)
@data.enter
@data.next
- @data.symbol.should == name
+ expect(@data.symbol).to eq(name)
@data.next
- @data.string.should == value
+ expect(@data.string).to eq(value)
end
it "raises an error when setting the wrong type in an array"
@@ -422,7 +422,7 @@ module Qpid
@data.enter
values.each do |value|
@data.next
- @data.int. should == value
+ expect(@data.int).to eq(value)
end
end
@@ -436,13 +436,13 @@ module Qpid
values.each { |value| @data.string = value }
@data.exit
- @data.array.should == [values.size, true, Qpid::Proton::STRING]
+ expect(@data.array).to match_array([values.size, true, Qpid::Proton::STRING])
@data.enter
@data.next
- @data.symbol.should == descriptor
+ expect(@data.symbol).to eq(descriptor)
values.each do |value|
@data.next
- @data.string.should == value
+ expect(@data.string).to eq(value)
end
end
@@ -457,7 +457,7 @@ module Qpid
@data.enter
values.each do |value|
@data.next
- @data.string.should == value
+ expect(@data.string).to eq(value)
end
end
@@ -478,9 +478,9 @@ module Qpid
@data.enter
keys.each do |key|
@data.next
- @data.string.should == key
+ expect(@data.string).to eq(key)
@data.next
- @data.string.should == values[key]
+ expect(@data.string).to eq(values[key])
end
end
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/60cd60a5/proton-c/bindings/ruby/spec/qpid/proton/hash_spec.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/qpid/proton/hash_spec.rb b/proton-c/bindings/ruby/spec/qpid/proton/hash_spec.rb
index a79af72..8cf0c63 100644
--- a/proton-c/bindings/ruby/spec/qpid/proton/hash_spec.rb
+++ b/proton-c/bindings/ruby/spec/qpid/proton/hash_spec.rb
@@ -35,7 +35,8 @@ describe "The extended hash type" do
it "can be put into an instance of Data" do
@hash.proton_data_put(@data)
result = Hash.proton_data_get(@data)
- result.should be_eql(@hash)
+ expect(result.keys).to match_array(@hash.keys)
+ expect(result.values).to match_array(@hash.values)
end
it "raises an error when retrieved from a nil Data instance" do
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/60cd60a5/proton-c/bindings/ruby/spec/qpid/proton/message_spec.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/qpid/proton/message_spec.rb b/proton-c/bindings/ruby/spec/qpid/proton/message_spec.rb
index 95f358d..df052c9 100644
--- a/proton-c/bindings/ruby/spec/qpid/proton/message_spec.rb
+++ b/proton-c/bindings/ruby/spec/qpid/proton/message_spec.rb
@@ -30,39 +30,39 @@ module Qpid
end
it "can be created" do
- @message.should_not be_nil
+ expect(@message).not_to be_nil
end
it "can be cleared" do
subject = random_string(16)
@message.subject = subject
- @message.subject.should eq(subject)
+ expect(@message.subject).to eq(subject)
@message.clear
- @message.subject.should_not eq(subject)
+ expect(@message.subject).not_to eq(subject)
end
it "has an error number" do
- @message.error?.should_not be_true
+ expect(@message.error?).to eq(false)
@message.format = Qpid::Proton::MessageFormat::AMQP
@message.content = "{"
- @message.error?.should be_true
- @message.errno.should_not eq(0)
+ expect(@message.error?).to eq(true)
+ expect(@message.errno).not_to eq(0)
end
it "has an error message" do
- @message.error?.should_not be_true
- @message.error.should be_nil
+ expect(@message.error?).to eq(false)
+ expect(@message.error).to be_nil
@message.format = Qpid::Proton::MessageFormat::AMQP
@message.content = "{"
- @message.error?.should be_true
- @message.error.should_not eq("")
+ expect(@message.error?).to eq(true)
+ expect(@message.error).not_to eq("")
end
it "can be durable" do
@message.durable = true
- @message.durable.should be_true
+ expect(@message.durable).to eq(true)
@message.durable = false
- @message.durable.should_not be_true
+ expect(@message.durable).to eq(false)
end
it "raises an error when setting durable to nil" do
@@ -86,7 +86,7 @@ module Qpid
it "sets the priority to the integer portion when a float" do
priority = rand(100) / 10
@message.priority = priority
- @message.priority.should eq(priority.floor)
+ expect(@message.priority).to eq(priority.floor)
end
it "rejects a priority with too large of a value" do
@@ -104,7 +104,7 @@ module Qpid
it "has a priority" do
priority = rand(256)
@message.priority = priority
- @message.priority.should equal(priority)
+ expect(@message.priority).to eq(priority)
end
it "raises an error when setting the time-to-live to nil" do
@@ -122,7 +122,7 @@ module Qpid
it "sets the time-to-live to the integer portion when a float" do
ttl = (rand(32767) / 10)
@message.ttl = ttl
- @message.ttl.should equal(ttl.floor)
+ expect(@message.ttl).to eq(ttl.floor)
end
it "raises an error when the time-to-live is negative" do
@@ -134,7 +134,7 @@ module Qpid
it "has a time-to-live" do
ttl = rand(32767)
@message.ttl = ttl
- @message.ttl.should equal(ttl)
+ expect(@message.ttl).to eq(ttl)
end
it "raises an error when setting first acquirer to nil" do
@@ -151,10 +151,10 @@ module Qpid
it "has a first acquirer" do
@message.first_acquirer = true
- @message.first_acquirer?.should be_true
+ expect(@message.first_acquirer?).to eq(true)
@message.first_acquirer = false
- @message.first_acquirer?.should_not be_true
+ expect(@message.first_acquirer?).to eq(false)
end
it "raises an error on a nil delivery count" do
@@ -178,79 +178,79 @@ module Qpid
it "converts a floating point delivery count to its integer portion" do
count = rand(255) / 10.0
@message.delivery_count = count
- @message.delivery_count.should eq(count.floor)
+ expect(@message.delivery_count).to eq(count.floor)
end
it "has a delivery count" do
count = rand(255)
@message.delivery_count = count
- @message.delivery_count.should eq(count)
+ expect(@message.delivery_count).to eq(count)
end
it "allows setting a nil id" do
@message.id = nil
- @message.id.should be_nil
+ expect(@message.id).to be_nil
end
it "has an id" do
id = random_string(16)
@message.id = id
- @message.id.should eq(id)
+ expect(@message.id).to eq(id)
end
it "allows setting a nil user id" do
@message.user_id = nil
- @message.user_id.should eq("")
+ expect(@message.user_id).to eq("")
end
it "has a user id" do
id = random_string(16)
@message.user_id = id
- @message.user_id.should eq(id)
+ expect(@message.user_id).to eq(id)
end
it "allows setting a nil address" do
@message.address = nil
- @message.address.should be_nil
+ expect(@message.address).to be_nil
end
it "has an address" do
address = "//0.0.0.0/#{random_string(16)}"
@message.address = address
- @message.address.should eq(address)
+ expect(@message.address).to eq(address)
end
it "allows setting a nil subject" do
@message.subject = nil
- @message.subject.should be_nil
+ expect(@message.subject).to be_nil
end
it "has a subject" do
subject = random_string(50)
@message.subject = subject
- @message.subject.should eq(subject)
+ expect(@message.subject).to eq(subject)
end
it "will allow a nil reply-to address" do
@message.reply_to = nil
- @message.reply_to.should be_nil
+ expect(@message.reply_to).to be_nil
end
it "has a reply-to address" do
address = "//0.0.0.0/#{random_string(16)}"
@message.reply_to = address
- @message.reply_to.should eq(address)
+ expect(@message.reply_to).to eq(address)
end
it "will allow a nil correlation id" do
@message.correlation_id = nil
- @message.correlation_id.should be_nil
+ expect(@message.correlation_id).to be_nil
end
it "has a correlation id" do
id = random_string(25)
@message.correlation_id = id
- @message.correlation_id.should eq(id)
+ expect(@message.correlation_id).to eq(id)
end
it "raises an error when setting a nil format" do
@@ -268,35 +268,35 @@ module Qpid
it "has a format" do
Qpid::Proton::MessageFormat.formats.each do |format|
@message.format = format
- @message.format.should eq(format)
+ expect(@message.format).to eq(format)
end
end
it "will allow a nil content type" do
@message.content_type = nil
- @message.content_type.should be_nil
+ expect(@message.content_type).to be_nil
end
it "will allow an empty content type" do
@message.content_type = ""
- @message.content_type.should eq("")
+ expect(@message.content_type).to eq("")
end
it "has a content type" do
content_type = random_string(32)
@message.content_type = content_type
- @message.content_type.should eq(content_type)
+ expect(@message.content_type).to eq(content_type)
end
it "can have nil content encoding" do
@message.content_encoding = nil
- @message.content_encoding.should be_nil
+ expect(@message.content_encoding).to be_nil
end
it "has a content encoding" do
encoding = "#{random_string(8)}/#{random_string(8)}"
@message.content_encoding = encoding
- @message.content_encoding.should eq(encoding)
+ expect(@message.content_encoding).to eq(encoding)
end
it "raises an error on a nil expiry time" do
@@ -313,13 +313,13 @@ module Qpid
it "can have a zero expiry time" do
@message.expires = 0
- @message.expires.should equal(0)
+ expect(@message.expires).to equal(0)
end
it "has an expiry time" do
time = rand(65535)
@message.expires = time
- @message.expires.should equal(time)
+ expect(@message.expires).to eq(time)
end
it "raises an error on a nil creation time" do
@@ -336,29 +336,29 @@ module Qpid
it "can have a zero creation time" do
@message.creation_time = 0
- @message.creation_time.should equal(0)
+ expect(@message.creation_time).to eq(0)
end
it "has a creation time" do
time = rand(65535)
@message.creation_time = time
- @message.creation_time.should equal(time)
+ expect(@message.creation_time).to eq(time)
end
it "can have a nil group id" do
@message.group_id = nil
- @message.group_id.should be_nil
+ expect(@message.group_id).to be_nil
end
it "can have an empty group id" do
@message.group_id = ""
- @message.group_id.should eq("")
+ expect(@message.group_id).to eq("")
end
it "has a group id" do
id = random_string(16)
@message.group_id = id
- @message.group_id.should eq(id)
+ expect(@message.group_id).to eq(id)
end
@@ -371,61 +371,61 @@ module Qpid
it "can have a negative group sequence" do
seq = (0 - rand(32767))
@message.group_sequence = seq
- @message.group_sequence.should eq(seq)
+ expect(@message.group_sequence).to eq(seq)
end
it "can have a zero group sequence" do
@message.group_sequence = 0
- @message.group_sequence.should eq(0)
+ expect(@message.group_sequence).to eq(0)
end
it "has a group sequence" do
id = rand(32767)
@message.group_sequence = id
- @message.group_sequence.should eq(id)
+ expect(@message.group_sequence).to eq(id)
end
it "can have a nil reply-to group id" do
@message.reply_to_group_id = nil
- @message.reply_to_group_id.should be_nil
+ expect(@message.reply_to_group_id).to be_nil
end
it "can have an empty reply-to group id" do
@message.reply_to_group_id = ""
- @message.reply_to_group_id.should eq("")
+ expect(@message.reply_to_group_id).to eq("")
end
it "has a reply-to group id" do
id = random_string(16)
@message.reply_to_group_id = id
- @message.reply_to_group_id.should eq(id)
+ expect(@message.reply_to_group_id).to eq(id)
end
it "can have an empty string as content" do
@message.content = ""
- @message.content.should eq("")
+ expect(@message.content).to eq("")
end
it "can have content" do
content = random_string(255)
@message.content = content
- @message.content.should eq(content)
+ expect(@message.content).to eq(content)
end
it "has properties" do
- @message.should respond_to(:properties)
- @message.should respond_to(:properties=)
- @message.should respond_to(:[])
- @message.should respond_to(:[]=)
+ expect(@message).to respond_to(:properties)
+ expect(@message).to respond_to(:properties=)
+ expect(@message).to respond_to(:[])
+ expect(@message).to respond_to(:[]=)
- @message.properties.should be_kind_of({}.class)
+ expect(@message.properties).to be_kind_of({}.class)
end
it "can replace the set of properties" do
values = random_hash(128)
@message.properties = values.clone
- @message.properties.should eq values
+ expect(@message.properties).to eq(values)
end
it "can set properties" do
@@ -433,7 +433,7 @@ module Qpid
value = random_string(128)
@message[name] = value
- @message[name].should eq(value)
+ expect(@message[name]).to eq(value)
end
it "can update properties" do
@@ -441,11 +441,11 @@ module Qpid
value = random_string(128)
@message[name] = value
- @message[name].should eq(value)
+ expect(@message[name]).to eq(value)
value = random_string(128)
@message[name] = value
- @message[name].should eq(value)
+ expect(@message[name]).to eq(value)
end
it "can hold a null property" do
@@ -453,10 +453,10 @@ module Qpid
value = random_string(128)
@message[name] = value
- @message[name].should eq(value)
+ expect(@message[name]).to eq(value)
@message[name] = nil
- @message[name].should be_nil
+ expect(@message[name]).to be_nil
end
it "can delete a property" do
@@ -464,10 +464,10 @@ module Qpid
value = random_string(128)
@message[name] = value
- @message[name].should eq(value)
+ expect(@message[name]).to eq(value)
@message.delete_property(name)
- @message.properties.keys.should_not include(name)
+ expect(@message.properties.keys).to_not include(name)
end
it "has no properties after being cleared" do
@@ -475,15 +475,15 @@ module Qpid
value = random_string(128)
@message[name] = value
- @message[name].should eq(value)
+ expect(@message[name]).to eq(value)
@message.clear
- @message.properties.should be_empty
+ expect(@message.properties).to be_empty
end
it "has instructions" do
- @message.should respond_to(:instructions)
- @message.should respond_to("instructions=".to_sym)
+ expect(@message).to respond_to(:instructions)
+ expect(@message).to respond_to("instructions=".to_sym)
end
it "can set an instruction" do
@@ -491,7 +491,7 @@ module Qpid
value = random_string(128)
@message.instructions[name] = value
- @message.instructions[name].should eq(value)
+ expect(@message.instructions[name]).to eq(value)
end
it "can update an instruction" do
@@ -499,11 +499,11 @@ module Qpid
value = random_string(128)
@message.instructions[name] = value
- @message.instructions[name].should eq(value)
+ expect(@message.instructions[name]).to eq(value)
value = random_string(128)
@message.instructions[name] = value
- @message.instructions[name].should eq(value)
+ expect(@message.instructions[name]).to eq(value)
end
it "can delete the instructions" do
@@ -511,48 +511,47 @@ module Qpid
value = random_string(128)
@message.instructions[name] = value
- @message.instructions.should_not be_empty
+ expect(@message.instructions).to_not be_empty
@message.instructions = nil
- @message.instructions.should be_nil
+ expect(@message.instructions).to be_nil
end
it "can replace the instructions" do
values = random_hash(rand(128) + 1)
@message.instructions = values.clone
- @message.instructions.should eq values
+ expect(@message.instructions).to eq(values)
values = random_hash(rand(64) + 1)
@message.instructions = values.clone
- @message.instructions.should eq values
+ expect(@message.instructions).to eq(values)
end
it "can delete the set of instructions" do
values = random_hash(rand(128) + 1)
@message.instructions = values.clone
- @message.instructions.should eq values
+ expect(@message.instructions).to eq(values)
@message.instructions = nil
- @message.instructions.should be_nil
+ expect(@message.instructions).to be_nil
end
it "has no instructions after being cleared" do
- name = random_string(16)
- value = random_string(128)
+ value = random_hash(128)
- @message.instructions = value
- @message.instructions.should eq(value)
+ @message.instructions = value.clone
+ expect(@message.instructions).to eq(value)
- @message.clear
- @message.instructions.should be_empty
+ @message.clear
+ expect(@message.instructions).to be_empty
end
it "has annotations" do
- @message.should respond_to(:annotations)
- @message.should respond_to(:annotations=)
+ expect(@message).to respond_to(:annotations)
+ expect(@message).to respond_to(:annotations=)
end
it "can set an annotation" do
@@ -560,7 +559,7 @@ module Qpid
value = random_hash(256)
@message.annotations[name] = value.clone
- @message.annotations[name].should eq(value)
+ expect(@message.annotations[name]).to eq(value)
end
it "can update an annotation" do
@@ -568,12 +567,12 @@ module Qpid
value = random_hash(256)
@message.annotations[name] = value.clone
- @message.annotations[name].should eq(value)
+ expect(@message.annotations[name]).to eq(value)
value = random_hash(128)
@message.annotations[name] = value.clone
- @message.annotations[name].should eq(value)
+ expect(@message.annotations[name]).to eq(value)
end
it "can delete an annotation" do
@@ -581,52 +580,51 @@ module Qpid
value = random_hash(256)
@message.annotations[name] = value.clone
- @message.annotations[name].should eq(value)
+ expect(@message.annotations[name]).to eq(value)
@message.annotations[name] = nil
- @message.annotations[name].should be_nil
+ expect(@message.annotations[name]).to be_nil
end
it "can replace all annotations" do
values = random_hash(rand(128) + 1)
@message.annotations = values.clone
- @message.annotations.should eq values
+ expect(@message.annotations).to eq(values)
values = random_hash(rand(64) + 1)
@message.annotations = values.clone
- @message.annotations.should eq values
+ expect(@message.annotations).to eq(values)
end
it "can delete the set of annotations" do
- values = random_hash(rand(128) + 1)
+ value = random_hash(rand(128) + 1)
- @message.annotations = values.clone
- @message.annotations.should eq values
+ @message.annotations = value.clone
+ expect(@message.annotations).to eq(value)
@message.annotations = nil
- @message.annotations.should be_nil
+ expect(@message.annotations).to be_nil
end
it "has no annotations after being cleared" do
- name = random_string(16)
- value = random_string(128)
+ value = random_hash(16)
@message.annotations = value
- @message.annotations.should eq(value)
+ expect(@message.annotations).to eq(value)
@message.clear
- @message.annotations.should be_empty
+ expect(@message.annotations).to be_empty
end
it "has a body property" do
- @message.should respond_to(:body)
- @message.should respond_to(:body=)
+ expect(@message).to respond_to(:body)
+ expect(@message).to respond_to(:body=)
end
it "has a default body that is nil" do
- @message.body.should be_nil
+ expect(@message.body).to be_nil
end
it "has no body after being cleared" do
@@ -634,10 +632,10 @@ module Qpid
value = random_string(128)
@message.body = value
- @message.body.should eq(value)
+ expect(@message.body).to eq(value)
@message.clear
- @message.body.should be_nil
+ expect(@message.body).to be_nil
end
it "can set the body property" do
@@ -654,7 +652,7 @@ module Qpid
end
@message.body = value
- @message.body.should eq(value)
+ expect(@message.body).to eq(value)
end
end
@@ -672,10 +670,10 @@ module Qpid
end
@message.body = value
- @message.body.should eq(value)
+ expect(@message.body).to eq(value)
@message.body = nil
- @message.body.should be_nil
+ expect(@message.body).to be_nil
end
end
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/60cd60a5/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb b/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb
index 1b888c1..a99408c 100644
--- a/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb
+++ b/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb
@@ -38,13 +38,13 @@ module Qpid
end
it "will generate a name if one is not provided" do
- @messenger.name.should_not be_nil
+ expect(@messenger.name).to_not be_nil
end
it "will accept an assigned name" do
name = random_string(16)
msgr = Qpid::Proton::Messenger.new(name)
- msgr.name.should eq(name)
+ expect(msgr.name).to eq(name)
end
it "raises an error on a nil timeout" do
@@ -56,35 +56,35 @@ module Qpid
it "can have a negative timeout" do
timeout = (0 - rand(65535))
@messenger.timeout = timeout
- @messenger.timeout.should eq(timeout)
+ expect(@messenger.timeout).to eq(timeout)
end
it "has a timeout" do
timeout = rand(65535)
@messenger.timeout = timeout
- @messenger.timeout.should eq(timeout)
+ expect(@messenger.timeout).to eq(timeout)
end
it "has an error number" do
- @messenger.error?.should_not be_true
- @messenger.errno.should eq(0)
+ expect(@messenger.error?).to eq(false)
+ expect(@messenger.errno).to eq(0)
# force an error
expect {
@messenger.subscribe("amqp://~#{random_string}")
}.to raise_error(ProtonError)
- @messenger.error?.should be_true
- @messenger.errno.should_not eq(0)
+ expect(@messenger.error?).to eq(true)
+ expect(@messenger.errno).to_not eq(0)
end
it "has an error message" do
- @messenger.error?.should_not be_true
- @messenger.error.should be_nil
+ expect(@messenger.error?).to eq(false)
+ expect(@messenger.error).to be_nil
# force an error
expect {
@messenger.subscribe("amqp://~#{random_string}")
}.to raise_error(ProtonError)
- @messenger.error?.should be_true
- @messenger.errno.should_not be_nil
+ expect(@messenger.error?).to eq(true)
+ expect(@messenger.errno).to_not be_nil
end
it "can be started" do
@@ -109,47 +109,47 @@ module Qpid
expect {
@messenger.subscribe("amqp://~#{random_string}")
}.to raise_error(ProtonError)
- @messenger.error?.should be_true
- @messenger.errno.should_not be_nil
+ expect(@messenger.error?).to eq(true)
+ expect(@messenger.errno).to_not eq(nil)
end
it "can have a nil certificate" do
expect {
@messenger.certificate = nil
- @messenger.certificate.should be_nil
+ expect(@messenger.certificate).to be_nil
}.to_not raise_error
end
it "can have a certificate" do
cert = random_string(128)
@messenger.certificate = cert
- @messenger.certificate.should eq(cert)
+ expect(@messenger.certificate).to eq(cert)
end
it "can have a nil private key" do
expect {
@messenger.private_key = nil
- @messenger.private_key.should be_nil
+ expect(@messenger.private_key).to be_nil
}.to_not raise_error
end
it "can have a private key" do
key = random_string(128)
@messenger.private_key = key
- @messenger.private_key.should eq(key)
+ expect(@messenger.private_key).to eq(key)
end
it "can have a nil trusted certificates" do
expect {
@messenger.trusted_certificates = nil
- @messenger.trusted_certificates.should be_nil
+ expect(@messenger.trusted_certificates).to be_nil
}.to_not raise_error
end
it "has a list of trusted certificates" do
certs = random_string(128)
@messenger.trusted_certificates = certs
- @messenger.trusted_certificates.should eq(certs)
+ expect(@messenger.trusted_certificates).to eq(certs)
end
it "raises an error on a nil outgoing window" do
@@ -167,19 +167,19 @@ module Qpid
it "can have a negative outgoing window" do
window = 0 - (rand(256) + 1)
@messenger.outgoing_window = window
- @messenger.outgoing_window.should eq(window)
+ expect(@messenger.outgoing_window).to eq(window)
end
it "can have a positive outgoing window" do
window = (rand(256) + 1)
@messenger.outgoing_window = window
- @messenger.outgoing_window.should eq(window)
+ expect(@messenger.outgoing_window).to eq(window)
end
it "can have a zero outgoing window" do
window = 0
@messenger.outgoing_window = window
- @messenger.outgoing_window.should eq(window)
+ expect(@messenger.outgoing_window).to eq(window)
end
it "raises an error on a nil incoming window" do
@@ -197,29 +197,29 @@ module Qpid
it "can have a negative incoming window" do
window = 0 - (rand(256) + 1)
@messenger.incoming_window = window
- @messenger.incoming_window.should eq(window)
+ expect(@messenger.incoming_window).to eq(window)
end
it "can have a positive incoming window" do
window = (rand(256) + 1)
@messenger.incoming_window = window
- @messenger.incoming_window.should eq(window)
+ expect(@messenger.incoming_window).to eq(window)
end
it "can have a zero incoming window" do
window = 0
@messenger.incoming_window = window
- @messenger.incoming_window.should eq(window)
+ expect(@messenger.incoming_window).to eq(window)
end
it "can be put into passive mode" do
@messenger.passive = true
- @messenger.passive?.should be_true
+ expect(@messenger.passive?).to eq(true)
end
it "can be taken out of passive mode" do
@messenger.passive = false
- @messenger.passive?.should_not be_true
+ expect(@messenger.passive?).to eq(false)
end
it "can clear non-existent errors with failing" do
@@ -233,9 +233,9 @@ module Qpid
@messenger.accept # should cause an error
rescue; end
- @messenger.error.should_not be_nil
+ expect(@messenger.error).to_not be_nil
@messenger.clear_error
- @messenger.error.should be_nil
+ expect(@messenger.error).to be_nil
end
describe "once started" do
@@ -253,7 +253,7 @@ module Qpid
end
it "can subscribe to an address" do
- @messenger.subscribe("amqp://~0.0.0.0:#{5700+rand(1024)}").should_not be_nil
+ expect(@messenger.subscribe("amqp://~0.0.0.0:#{5700+rand(1024)}")).to_not be_nil
end
it "returns a tracker's status"
@@ -318,7 +318,7 @@ module Qpid
end
it "has an outgoing tracker" do
- @tracker.should_not be_nil
+ expect(@tracker).to_not be_nil
end
it "returns a tracker's status"
@@ -346,7 +346,7 @@ module Qpid
end
it "can check the status of a tracker" do
- @messenger.status(@tracker).should_not be_nil
+ expect(@messenger.status(@tracker)).to_not be_nil
end
end
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[4/4] qpid-proton git commit: PROTON-755: Require specific version of
minitest for Ruby tests.
Posted by mc...@apache.org.
PROTON-755: Require specific version of minitest for Ruby tests.
The require for the smoke tests now require a version between 4.7.0 and
not 5.0.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/e763ef4b
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/e763ef4b
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/e763ef4b
Branch: refs/heads/master
Commit: e763ef4bf224c96daefffad7607e14a43163cc55
Parents: 1dc43c6
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Mon Nov 24 13:48:37 2014 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Mon Dec 8 09:38:01 2014 -0500
----------------------------------------------------------------------
tests/ruby/proton-test | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e763ef4b/tests/ruby/proton-test
----------------------------------------------------------------------
diff --git a/tests/ruby/proton-test b/tests/ruby/proton-test
index 748e6f0..cc35ab7 100755
--- a/tests/ruby/proton-test
+++ b/tests/ruby/proton-test
@@ -1,5 +1,10 @@
#!/usr/bin/env ruby
+if RUBY_VERSION < "1.9"
+require 'rubygems'
+end
+
+gem 'minitest', '= 4.7.0', '< 5.0'
require 'test/unit'
require 'proton_tests/interop.rb'
require 'proton_tests/smoke.rb'
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org