mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Instantiates variables used during test execution.
Rspec complains when using non-instantiated instance variables in tests, even if they're not critical to the purpose of the test. This change ensures all instance variables used in, or executing during, tests have values.
This commit is contained in:
parent
98688a58ee
commit
60179afb4a
2 changed files with 8 additions and 3 deletions
|
@ -32,9 +32,12 @@ RSpec.describe HTTParty::ConnectionAdapter do
|
|||
end
|
||||
|
||||
describe ".call" do
|
||||
let(:uri) { URI 'http://www.google.com' }
|
||||
let(:options) { { foo: :bar } }
|
||||
|
||||
it "generates an HTTParty::ConnectionAdapter instance with the given uri and options" do
|
||||
expect(HTTParty::ConnectionAdapter).to receive(:new).with(@uri, @options).and_return(double(connection: nil))
|
||||
HTTParty::ConnectionAdapter.call(@uri, @options)
|
||||
expect(HTTParty::ConnectionAdapter).to receive(:new).with(uri, options).and_return(double(connection: nil))
|
||||
HTTParty::ConnectionAdapter.call(uri, options)
|
||||
end
|
||||
|
||||
it "calls #connection on the connection adapter" do
|
||||
|
@ -42,7 +45,7 @@ RSpec.describe HTTParty::ConnectionAdapter do
|
|||
connection = double('Connection')
|
||||
expect(adapter).to receive(:connection).and_return(connection)
|
||||
allow(HTTParty::ConnectionAdapter).to receive_messages(new: adapter)
|
||||
expect(HTTParty::ConnectionAdapter.call(@uri, @options)).to be connection
|
||||
expect(HTTParty::ConnectionAdapter.call(uri, options)).to be connection
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ RSpec.describe Net::HTTPHeader::DigestAuthenticator do
|
|||
include Net::HTTPHeader
|
||||
def initialize
|
||||
@header = {}
|
||||
@path = '/'
|
||||
@method = 'GET'
|
||||
end
|
||||
end).new
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue