Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
biow0lf committed Jan 2, 2025
1 parent 3f398ac commit 3f0ee8c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/eve_online/esi/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def query
def resource
@resource ||=
if http_method == :get
connection.public_send(http_method, uri)
connection.get(uri)
elsif http_method == :post
connection.public_send(http_method, uri, payload)
end
Expand Down
34 changes: 17 additions & 17 deletions spec/eve_online/esi/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -491,33 +491,33 @@

let(:connection) { double }

before { expect(subject).to receive(:http_method).and_return(http_method).twice }
before { expect(subject).to receive(:http_method).and_return(http_method) }

before { expect(subject).to receive(:uri).and_return(uri) }

before { expect(subject).to receive(:connection).and_return(connection) }

before { expect(connection).to receive(:public_send).with(http_method, uri).and_raise(Faraday::ConnectionFailed, nil) }
before { expect(connection).to receive(:get).with(uri).and_raise(Faraday::ConnectionFailed, nil) }

specify { expect { subject.resource }.to raise_error(EveOnline::Exceptions::Timeout) }
end

context "when throw Faraday::TimeoutError" do
# let(:http_method) { double }
#
# let(:uri) { double }
#
# let(:connection) { double }
#
# before { expect(subject).to receive(:http_method).and_return(http_method) }
#
# before { expect(subject).to receive(:uri).and_return(uri) }
#
# before { expect(subject).to receive(:connection).and_return(connection) }
#
# before { expect(connection).to receive(:public_send).with(http_method, uri).and_raise(Faraday::TimeoutError, nil) }
#
# specify { expect { subject.resource }.to raise_error(EveOnline::Exceptions::Timeout) }
let(:http_method) { :get }

let(:uri) { double }

let(:connection) { double }

before { expect(subject).to receive(:http_method).and_return(http_method) }

before { expect(subject).to receive(:uri).and_return(uri) }

before { expect(subject).to receive(:connection).and_return(connection) }

before { expect(connection).to receive(:get).with(uri).and_raise(Faraday::TimeoutError, nil) }

specify { expect { subject.resource }.to raise_error(EveOnline::Exceptions::Timeout) }
end
end

Expand Down

0 comments on commit 3f0ee8c

Please sign in to comment.