-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
126 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
.rspec_status | ||
# bundler | ||
.bundle | ||
Gemfile.lock | ||
|
||
# rspec | ||
.rspec_status | ||
|
||
# For MacOS: | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
--format documentation | ||
--color | ||
--order random | ||
--require spec_helper | ||
--format documentation | ||
--order random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
RSpec.describe FootballApi::Sideline do | ||
let(:response) { load_response('sidelined') } | ||
|
||
before(:each) do | ||
stub_request(:get, uri) | ||
.with(headers: @headers) | ||
.to_return(status: 200, body: response.to_json, headers: {}) | ||
end | ||
|
||
describe '.all_by_player' do | ||
let(:uri) { "#{@api_host}/sidelined/player/276" } | ||
|
||
it "requests the sidelined by player endpoint" do | ||
expect(described_class.all_by_player(276)).to eq(response.dig('api', 'sidelined')) | ||
end | ||
end | ||
|
||
describe '.all_by_coach' do | ||
let(:uri) { "#{@api_host}/sidelined/coach/2" } | ||
|
||
it "requests the sidelined by coach endpoint" do | ||
expect(described_class.all_by_coach(2)).to eq(response.dig('api', 'sidelined')) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"api": { | ||
"results": 25, | ||
"sidelined": [ | ||
{ | ||
"type": "Groin/Pelvis Injury", | ||
"start": "11/10/19", | ||
"end": "15/11/19" | ||
}, | ||
{ | ||
"type": "Ankle/Foot Injury", | ||
"start": "01/08/19", | ||
"end": "23/08/19" | ||
}, | ||
{ | ||
"type": "Suspended", | ||
"start": "15/05/19", | ||
"end": "27/05/19" | ||
}, | ||
{ | ||
"type": "Ankle/Foot Injury", | ||
"start": "24/01/19", | ||
"end": "20/04/19" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"api": { | ||
"results": 38, | ||
"trophies": [ | ||
{ | ||
"league": "Trophée des Champions", | ||
"country": "France", | ||
"season": "2019/2020", | ||
"place": "Winner" | ||
}, | ||
{ | ||
"league": "Copa America", | ||
"country": "South-America", | ||
"season": "2019 Brazil", | ||
"place": "Winner" | ||
}, | ||
{ | ||
"league": "Ligue 1", | ||
"country": "France", | ||
"season": "2018/2019", | ||
"place": "Winner" | ||
}, | ||
{ | ||
"league": "Coupe de France", | ||
"country": "France", | ||
"season": "2018/2019", | ||
"place": "2nd Place" | ||
}, | ||
{ | ||
"league": "Trophée des Champions", | ||
"country": "France", | ||
"season": "2018/2019", | ||
"place": "Winner" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
RSpec.describe FootballApi::Trophey do | ||
let(:response) { load_response('trophies') } | ||
|
||
before(:each) do | ||
stub_request(:get, uri) | ||
.with(headers: @headers) | ||
.to_return(status: 200, body: response.to_json, headers: {}) | ||
end | ||
|
||
describe '.all_by_player' do | ||
let(:uri) { "#{@api_host}/trophies/player/276" } | ||
|
||
it "requests the trophies by player endpoint" do | ||
expect(described_class.all_by_player(276)).to eq(response.dig('api', 'trophies')) | ||
end | ||
end | ||
|
||
describe '.all_by_coach' do | ||
let(:uri) { "#{@api_host}/trophies/coach/2" } | ||
|
||
it "requests the trophies by coach endpoint" do | ||
expect(described_class.all_by_coach(2)).to eq(response.dig('api', 'trophies')) | ||
end | ||
end | ||
end |