Sha256: 2349f4b612202cb6be1fffe8490690ed0acd42f376baa2aad70ead8e796bf376

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

 describe 'Teams' do 
   before(:all) { savon.mock!   }
   after(:all)  { savon.unmock! }

   before(:all) do
   	@client = Xmlsoccer::Client.new(api_key: "12345", api_type: 'Full')
   end

   describe "GetAllTeams" do

   	 before(:each) do
   	   message = {"ApiKey" => @client.api_key}
       fixture = File.read("spec/fixtures/request_manager/get_all_teams.xml")
       response = {code: 200, headers: {}, body: fixture}
       savon.expects(:get_all_teams).with(message: message).returns(response)
       @response = @client.get_all_teams
     end

     it 'returns an array' do
       expect(@response).to be_an_instance_of(Array)
     end
        
     it 'responds to team attributes' do
       expect(@response).to include(HashedResponses::GetAllTeams)
     end

   end

   describe "GetAllTeamsByLeagueAndSeason" do

     before(:each) do
       message = {"ApiKey" => @client.api_key, league: "English Premier League", season_date_string: "1011"}
       fixture = File.read("spec/fixtures/request_manager/get_all_teams_by_league_and_season.xml")
       response = {code: 200, headers: {}, body: fixture}
       savon.expects(:get_all_teams_by_league_and_season).with(message: message).returns(response)
       @response = @client.get_all_teams_by_league_and_season(league: "English Premier League", season_date_string: "1011")
     end

     it 'returns an array' do
       expect(@response).to be_an_instance_of(Array)
     end
        
     it 'responds to team attributes' do
       expect(@response).to include(HashedResponses::GetAllTeamsByLeagueAndSeason)
     end

   end

  
 end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xmlsoccer-0.1.0 spec/features/teams_spec.rb