spec/blather/jid_spec.rb in blather-0.6.2 vs spec/blather/jid_spec.rb in blather-0.7.0
- old
+ new
@@ -1,87 +1,87 @@
require 'spec_helper'
describe Blather::JID do
it 'does nothing if creaded from Blather::JID' do
jid = Blather::JID.new 'n@d/r'
- Blather::JID.new(jid).object_id.must_equal jid.object_id
+ Blather::JID.new(jid).object_id.should == jid.object_id
end
it 'creates a new Blather::JID from (n,d,r)' do
jid = Blather::JID.new('n', 'd', 'r')
- jid.node.must_equal 'n'
- jid.domain.must_equal 'd'
- jid.resource.must_equal 'r'
+ jid.node.should == 'n'
+ jid.domain.should == 'd'
+ jid.resource.should == 'r'
end
it 'creates a new Blather::JID from (n,d)' do
jid = Blather::JID.new('n', 'd')
- jid.node.must_equal 'n'
- jid.domain.must_equal 'd'
+ jid.node.should == 'n'
+ jid.domain.should == 'd'
end
it 'creates a new Blather::JID from (n@d)' do
jid = Blather::JID.new('n@d')
- jid.node.must_equal 'n'
- jid.domain.must_equal 'd'
+ jid.node.should == 'n'
+ jid.domain.should == 'd'
end
it 'creates a new Blather::JID from (n@d/r)' do
jid = Blather::JID.new('n@d/r')
- jid.node.must_equal 'n'
- jid.domain.must_equal 'd'
- jid.resource.must_equal 'r'
+ jid.node.should == 'n'
+ jid.domain.should == 'd'
+ jid.resource.should == 'r'
end
it 'requires at least a node' do
- proc { Blather::JID.new }.must_raise ::ArgumentError
+ proc { Blather::JID.new }.should raise_error ::ArgumentError
end
it 'ensures length of node is no more than 1023 characters' do
- proc { Blather::JID.new('n'*1024) }.must_raise Blather::ArgumentError
+ proc { Blather::JID.new('n'*1024) }.should raise_error Blather::ArgumentError
end
it 'ensures length of domain is no more than 1023 characters' do
- proc { Blather::JID.new('n', 'd'*1024) }.must_raise Blather::ArgumentError
+ proc { Blather::JID.new('n', 'd'*1024) }.should raise_error Blather::ArgumentError
end
it 'ensures length of resource is no more than 1023 characters' do
- proc { Blather::JID.new('n', 'd', 'r'*1024) }.must_raise Blather::ArgumentError
+ proc { Blather::JID.new('n', 'd', 'r'*1024) }.should raise_error Blather::ArgumentError
end
it 'compares Blather::JIDs' do
- (Blather::JID.new('a@b/c') <=> Blather::JID.new('d@e/f')).must_equal -1
- (Blather::JID.new('a@b/c') <=> Blather::JID.new('a@b/c')).must_equal 0
- (Blather::JID.new('d@e/f') <=> Blather::JID.new('a@b/c')).must_equal 1
+ (Blather::JID.new('a@b/c') <=> Blather::JID.new('d@e/f')).should == -1
+ (Blather::JID.new('a@b/c') <=> Blather::JID.new('a@b/c')).should == 0
+ (Blather::JID.new('d@e/f') <=> Blather::JID.new('a@b/c')).should == 1
end
it 'checks for equality' do
- (Blather::JID.new('n@d/r') == Blather::JID.new('n@d/r')).must_equal true
- Blather::JID.new('n@d/r').eql?(Blather::JID.new('n@d/r')).must_equal true
+ (Blather::JID.new('n@d/r') == Blather::JID.new('n@d/r')).should == true
+ Blather::JID.new('n@d/r').eql?(Blather::JID.new('n@d/r')).should == true
end
it 'will strip' do
jid = Blather::JID.new('n@d/r')
- jid.stripped.must_equal Blather::JID.new('n@d')
- jid.must_equal Blather::JID.new('n@d/r')
+ jid.stripped.should == Blather::JID.new('n@d')
+ jid.should == Blather::JID.new('n@d/r')
end
it 'will strip itself' do
jid = Blather::JID.new('n@d/r')
jid.strip!
- jid.must_equal Blather::JID.new('n@d')
+ jid.should == Blather::JID.new('n@d')
end
it 'has a string representation' do
- Blather::JID.new('n@d/r').to_s.must_equal 'n@d/r'
- Blather::JID.new('n', 'd', 'r').to_s.must_equal 'n@d/r'
- Blather::JID.new('n', 'd').to_s.must_equal 'n@d'
+ Blather::JID.new('n@d/r').to_s.should == 'n@d/r'
+ Blather::JID.new('n', 'd', 'r').to_s.should == 'n@d/r'
+ Blather::JID.new('n', 'd').to_s.should == 'n@d'
end
it 'provides a #stripped? helper' do
jid = Blather::JID.new 'a@b/c'
- jid.must_respond_to :stripped?
- jid.stripped?.wont_equal true
+ jid.should respond_to :stripped?
+ jid.stripped?.should_not equal true
jid.strip!
- jid.stripped?.must_equal true
+ jid.stripped?.should == true
end
end