Commit a6a7e6e2 authored by Sergey Gernyak's avatar Sergey Gernyak

:running: specs

parent 4f3c2d97
...@@ -4,22 +4,22 @@ describe BetfairApiNgRails::Api::Connection do ...@@ -4,22 +4,22 @@ describe BetfairApiNgRails::Api::Connection do
let(:acc_name) { 'user001' } let(:acc_name) { 'user001' }
let(:asm) { double(:account_session_manager) } let(:asm) { double(:account_session_manager) }
let(:account) { BetfairApiNgRails::Account.new(acc_name, 'pass', 'nfl43n7fg834', 'crt', 'key') } let(:account) { BetfairApiNgRails::Account.new(acc_name, 'pass', 'nfl43n7fg834', 'crt', 'key') }
let(:logger) { double(:logger) }
subject(:connection) { described_class.new(acc_name) } subject(:connection) { described_class.new(acc_name) }
before do before do
allow(BetfairApiNgRails).to receive(:account_session_manager).and_return asm allow(BetfairApiNgRails).to receive(:account_session_manager).and_return asm
BetfairApiNgRails.log = logger
allow(logger).to receive(:write)
end end
describe "#request" do describe "#request" do
let(:provider) { double(:provider) } let(:provider) { double(:provider) }
let(:parser) { double(:parser, process: true) } let(:parser) { double(:parser, process: true) }
let(:response) { double(:response, result: "") } let(:response) { double(:response, result: "") }
let(:logger) { double(:logger) }
before(:each) do before(:each) do
expect(subject).to receive(:init_parser).and_return parser expect(subject).to receive(:init_parser).and_return parser
BetfairApiNgRails.log = logger
allow(logger).to receive(:write)
end end
it "calls provider's fetch method" do it "calls provider's fetch method" do
...@@ -80,7 +80,7 @@ describe BetfairApiNgRails::Api::Connection do ...@@ -80,7 +80,7 @@ describe BetfairApiNgRails::Api::Connection do
describe '#account' do describe '#account' do
context 'when it is found' do context 'when it is found' do
it 'returns this one' do it 'returns this one' do
expect(BetfairApiNgRails).to receive_message_chain(:account_manager, :get).and_return double expect(BetfairApiNgRails).to receive_message_chain(:account_manager, :get).and_return double(:acc, username: :user001)
connection.send :account connection.send :account
end end
end end
......
...@@ -2,9 +2,15 @@ require 'spec_helper' ...@@ -2,9 +2,15 @@ require 'spec_helper'
describe BetfairApiNgRails::Api::RequestMethod do describe BetfairApiNgRails::Api::RequestMethod do
let(:method_name) { 'someMethod' } let(:method_name) { 'someMethod' }
let(:logger) { double(:logger) }
subject(:method) { described_class.new(method_name) } subject(:method) { described_class.new(method_name) }
before do
BetfairApiNgRails.log = logger
allow(logger).to receive(:write)
end
context 'has attributes' do context 'has attributes' do
its(:name) { is_expected.to eq(method_name) } its(:name) { is_expected.to eq(method_name) }
end end
......
...@@ -2,7 +2,12 @@ require 'spec_helper' ...@@ -2,7 +2,12 @@ require 'spec_helper'
require 'betfair_api_ng_rails/api/constants' require 'betfair_api_ng_rails/api/constants'
describe BetfairApiNgRails::Api::RequestMethods do describe BetfairApiNgRails::Api::RequestMethods do
before { BetfairApiNgRails.config.locale = :en } let(:logger) { double(:logger) }
before do
BetfairApiNgRails.config.locale = :en
BetfairApiNgRails.log = logger
allow(logger).to receive(:write)
end
BetfairApiNgRails::Api::Constants::SIMPLE_LISTING_FILTERED.each do |method| BetfairApiNgRails::Api::Constants::SIMPLE_LISTING_FILTERED.each do |method|
describe "##{method}" do describe "##{method}" do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment