spec/unit/webmoney_spec.rb in webmoney-0.0.4.4 vs spec/unit/webmoney_spec.rb in webmoney-0.0.4.5
- old
+ new
@@ -22,10 +22,20 @@
t2 = @wm.send(:reqn)
t1.should match(/^\d{16}$/)
(t2 > t1).should be_true
end
+ it "should correct reqn" do
+ Time.stub!(:now).and_return(Time.at(1244704683.69677))
+ @wm.send(:reqn).should == '2009061111180369'
+ end
+
+ it "should correct reqn with zero microsec" do
+ Time.stub!(:now).and_return(Time.at(1244704683))
+ @wm.send(:reqn).should == '2009061111180300'
+ end
+
it "should raise error on incorrect arg" do
lambda { @wm.send(:request, :check_sign, 1) }.
should raise_error(ArgumentError)
end
@@ -85,9 +95,17 @@
@wm.errormsg.should match(%r{неверно указан проверяемый WMID})
end
it "should get_passport" do
@wm.request(:get_passport, :wmid => @wm.wmid).should be_instance_of(Passport)
+ end
+
+ it "should raise exception on bad WMID" do
+ lambda {@wm.request(:get_passport, :wmid => '111')}.should raise_error(Webmoney::ResultError)
+ end
+
+ it "should raise exception on non existent WMID" do
+ lambda {@wm.request(:get_passport, :wmid => '012345678901')}.should raise_error(Webmoney::NonExistentWmidError)
end
it "should return correct BL" do
wmid = '370860915669'
@wm.request(:bussines_level, :wmid => wmid).should == 0
\ No newline at end of file