-
Notifications
You must be signed in to change notification settings - Fork 30
Add support for HTTP Basic Authentication #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| api = Blanket::wrap("http://api.example.org", basic_auth: basic_auth) | ||
| api.users(55).get | ||
|
|
||
| expect(HTTParty).to have_received(:get).with('http://api.example.org/users/55', basic_auth: basic_auth) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Line is too long. [111/80]
| end | ||
|
|
||
| it 'allows setting parameters globally' do | ||
| api = Blanket::wrap("http://api.example.org", basic_auth: basic_auth) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use :: for method calls.
| expect(HTTParty).to have_received(:get).with('http://api.example.org/users/55', basic_auth: basic_auth) | ||
| end | ||
|
|
||
| it 'allows setting parameters globally' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| it 'allows sending parameters in a request' do | ||
| api.users(55).get(basic_auth: basic_auth) | ||
|
|
||
| expect(HTTParty).to have_received(:get).with('http://api.example.org/users/55', basic_auth: basic_auth) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Line is too long. [111/80]
| allow(HTTParty).to receive(:get) { StubbedResponse.new } | ||
| end | ||
|
|
||
| it 'allows sending parameters in a request' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| end | ||
|
|
||
| describe 'Basic Auth' do | ||
| let(:basic_auth) { {username: 'foo', password: 'bar'} } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space inside { missing.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Space inside } missing.
| end | ||
| end | ||
|
|
||
| describe 'Basic Auth' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
|
Would be nice to have this feature in master. |
| api = Blanket::wrap("http://api.example.org", basic_auth: basic_auth) | ||
| api.users(55).get | ||
|
|
||
| expect(HTTParty).to have_received(:get).with('http://api.example.org/users/55', basic_auth: basic_auth) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [111/80]
| end | ||
|
|
||
| it 'allows setting parameters globally' do | ||
| api = Blanket::wrap("http://api.example.org", basic_auth: basic_auth) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/ColonMethodCall: Do not use :: for method calls.
| expect(HTTParty).to have_received(:get).with('http://api.example.org/users/55', basic_auth: basic_auth) | ||
| end | ||
|
|
||
| it 'allows setting parameters globally' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| it 'allows sending parameters in a request' do | ||
| api.users(55).get(basic_auth: basic_auth) | ||
|
|
||
| expect(HTTParty).to have_received(:get).with('http://api.example.org/users/55', basic_auth: basic_auth) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [111/80]
| allow(HTTParty).to receive(:get) { StubbedResponse.new } | ||
| end | ||
|
|
||
| it 'allows sending parameters in a request' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| end | ||
|
|
||
| describe 'Basic Auth' do | ||
| let(:basic_auth) { {username: 'foo', password: 'bar'} } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
| end | ||
| end | ||
|
|
||
| describe 'Basic Auth' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
|
Why has this never made it to master? Is there any more up to date gem? |
Complete with spec and Readme updates :)