spec/unit/webmoney_spec.rb in webmoney-0.0.4.6 vs spec/unit/webmoney_spec.rb in webmoney-0.0.4.8
- old
+ new
@@ -1,19 +1,15 @@
require File.dirname(__FILE__) + '/../spec_helper'
-class Webmoney
+module Webmoney
describe Webmoney, "class" do
before(:each) do
@wm = webmoney()
end
- it "should be instance of Webmoney" do
- @wm.should be_instance_of(Webmoney)
- end
-
it "should be classic" do
@wm.classic?.should be_true
end
it "should return reqn" do
@@ -93,14 +89,10 @@
lambda { @wm.request(:get_passport, :wmid => '') }.should raise_error(ResultError)
@wm.error.should == 2
@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
@@ -115,18 +107,20 @@
bl = @wm.request(:bussines_level, :wmid => wmid)
(bl > 1000).should be_true
end
it "should send message" do
- result = @wm.request(:send_message,
- :wmid => @wm.wmid, :subj => 'Текст', :text => 'Тело <b>сообщения</b>')
+ result = @wm.request( :send_message,
+ :wmid => @wm.wmid,
+ :subj => 'Текст',
+ :text => 'Тело <b>сообщения</b>')
result.should be_kind_of(Hash)
result[:id].should match(/^\d*$/)
((result[:date] + 60) > Time.now).should be_true
end
it "should raise error on undefined xml func" do
- lambda { @wm.request(:unexistent_interface) }.should raise_error(::NotImplementedError)
+ lambda { @wm.request(:unexistent_interface) }.should raise_error(::NoMethodError)
end
end
end
\ No newline at end of file