Skip to content
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

Improved testability #4

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Improved testability #4

wants to merge 4 commits into from

Conversation

cpetersen
Copy link

@cpetersen cpetersen commented Aug 23, 2024

This pull request does the following:

  • adds rspec as a development dependency
  • Removes the spec/tasks files and moves their tests into rspec
  • Makes a small tweak to allow passing in a Faraday test adapter and stub so users of the library can stub network requests to it.
  • Adds the ability to configure a logger
  • Adds descriptions of the above features to the README.

You can test it locally with the following commands:

ollama pull phi
ollama pull yi:latest
ollama serve

# In a different terminal, in the project directory
bundle exec rspec

@@ -143,6 +141,14 @@ def request(path, payload = nil, server_sent_events: nil, request_method: 'POST'
raise Errors::RequestError.new(e.message, request: e, payload:)
end

def faraday
Faraday.new(request: @request_options) do |faraday|
faraday.adapter *@faraday_adapter
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the line I needed to modify. The splat is required so I can pass in [:test, stubs] as the adapter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant