spec/lib/epp-eis/credit_spec.rb in epp-eis-1.0.2 vs spec/lib/epp-eis/credit_spec.rb in epp-eis-2.0.0

- old
+ new

@@ -1,25 +1,39 @@ require 'spec_helper' describe Epp::Eis::CreditCommands do before(:each) do - @server = Epp::Server.new(:server => '127.0.0.1', :tag => 'username', :password => 'password') + @server = Epp::Server.new(server: '127.0.0.1', tag: 'username', password: 'password') end describe 'credit_info' do + context 'request' do + before(:each) do + expect(@server).to receive(:send_request) do |xml| + @request = Nokogiri::XML(xml) + xml_mock('responses/credit/credit_info.xml') + end + @response = @server.credit_info + end + + it 'contains credit info in fred namespace' do + expect(@request.css('fred|creditInfo', 'fred' => Epp::Eis::XML_NS_FRED)).not_to be_empty + end + end + context 'when response is successful' do before(:each) do - @server.stub(:send_request).and_return(xml_mock('responses/credit/credit_info.xml')) + expect(@server).to receive(:send_request).and_return(xml_mock('responses/credit/credit_info.xml')) @response = @server.credit_info end it 'returns response code' do - @response.code.should == 1000 + expect(@response.code).to eq(1000) end it 'returns hash of credits by TLD' do - @response.zone_credits['ee'].should == '1234.56' + expect(@response.zone_credits['ee']).to eq('1234.56') end end end end