forked from nbulaj/proxy_fetcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nbulaj#14: allow to set custom proxy for Client
- Loading branch information
Showing
10 changed files
with
77 additions
and
14 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
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
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
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
File renamed without changes.
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,43 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe ProxyFetcher::Client::ProxiesRegistry do | ||
context '#manager' do | ||
it 'instantiates ProxyFetcher::Manager instance' do | ||
expect(described_class.manager).not_to be_nil | ||
expect(described_class.manager).to be_an_instance_of(ProxyFetcher::Manager) | ||
end | ||
|
||
it 'caches manager instance' do | ||
expect(described_class.manager).to eq(described_class.manager) | ||
end | ||
end | ||
|
||
context '#invalidate_proxy!' do | ||
it 'removes proxy from the list' do | ||
proxy = described_class.manager.proxies.first | ||
described_class.invalidate_proxy!(proxy) | ||
|
||
expect(described_class.manager.proxies).not_to include(proxy) | ||
end | ||
|
||
it 'refreshes the list if it is empty' do | ||
proxy = described_class.manager.proxies.first | ||
described_class.manager.instance_variable_set(:'@proxies', [proxy]) | ||
|
||
described_class.invalidate_proxy!(proxy) | ||
|
||
expect(described_class.manager.proxies.count).to be > 1 | ||
end | ||
end | ||
|
||
context '#find_proxy_for' do | ||
it 'searches for specific proxy based on URL schema type' do | ||
expect(described_class.find_proxy_for('http://google.com')).not_to be_nil | ||
|
||
proxy = described_class.find_proxy_for('https://google.com') | ||
expect(proxy.ssl?).to be_truthy | ||
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,3 @@ | ||
RSpec.describe ProxyFetcher::VERSION do | ||
it { expect(ProxyFetcher::VERSION::STRING).to eq '0.6.3' } | ||
end |