forked from alexrudall/ruby-openai
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspec_helper.rb
35 lines (28 loc) · 1.09 KB
/
spec_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require "bundler/setup"
require "dotenv/load"
require "ruby/openai"
require "vcr"
Dir[File.expand_path("spec/support/**/*.rb")].sort.each { |f| require f }
VCR.configure do |c|
c.hook_into :webmock
c.cassette_library_dir = "spec/fixtures/cassettes"
c.default_cassette_options = { record: ENV["NO_VCR"] == "true" ? :all : :new_episodes,
match_requests_on: [:method, :uri, VCRMultipartMatcher.new] }
c.filter_sensitive_data("<OPENAI_ACCESS_TOKEN>") { Ruby::OpenAI.configuration.access_token }
c.filter_sensitive_data("<OPENAI_ORGANIZATION_ID>") { Ruby::OpenAI.configuration.organization_id }
end
RSpec.configure do |c|
# Enable flags like --only-failures and --next-failure
c.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
c.disable_monkey_patching!
c.expect_with :rspec do |rspec|
rspec.syntax = :expect
end
c.before(:all) do
Ruby::OpenAI.configure do |config|
config.access_token = ENV.fetch("OPENAI_ACCESS_TOKEN")
end
end
end
RSPEC_ROOT = File.dirname __FILE__