Fix some tests
This commit is contained in:
parent
02d7dfb1dc
commit
2750319f77
10 changed files with 34 additions and 79 deletions
|
@ -1,26 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Github::API do
|
||||
|
||||
describe '.base_uri' do
|
||||
it { expect(described_class.base_uri).to eq 'https://api.github.com' }
|
||||
end
|
||||
|
||||
describe '.latest_release' do
|
||||
subject { described_class.latest_release }
|
||||
|
||||
context 'when github is up', vcr: {cassette_name: 'github_lastrelease'} do
|
||||
it { expect(subject).to be_a RestClient::Response }
|
||||
it { expect(subject.code).to eq 200 }
|
||||
end
|
||||
|
||||
context 'when github is down' do
|
||||
|
||||
before do
|
||||
allow_any_instance_of(RestClient::Resource).to receive(:get).and_raise(RestClient::Forbidden)
|
||||
end
|
||||
|
||||
it { is_expected.to be_nil }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,23 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Github::Releases do
|
||||
|
||||
describe '.latest' do
|
||||
|
||||
subject { described_class.latest }
|
||||
|
||||
context 'when github is up', vcr: {cassette_name: 'github_lastrelease'} do
|
||||
it { expect(subject.url).to eq 'https://api.github.com/repos/sgmap/tps/releases/4685573' }
|
||||
it { expect(subject.body).to match /.*[Nouveautés].*/ }
|
||||
it { expect(subject.published_at).to match /[0-9][0-9][\/][0-9][0-9][\/][0-9][0-9][0-9][0-9]/ }
|
||||
end
|
||||
|
||||
context 'when github is down' do
|
||||
before do
|
||||
allow_any_instance_of(RestClient::Resource).to receive(:get).and_raise(RestClient::Forbidden)
|
||||
end
|
||||
|
||||
it { is_expected.to be_nil }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue