Skip to content

Commit

Permalink
u
Browse files Browse the repository at this point in the history
  • Loading branch information
kojix2 committed Jan 30, 2025
1 parent f6a323e commit 07b3b00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 7 additions & 1 deletion spec/translator_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ describe DeepL::Translator do

it "can get deepl api key from environment variable" do
dummy_api_key = "dummy_env_key"
original_api_key = ENV["DEEPL_AUTH_KEY"]?
ENV["DEEPL_AUTH_KEY"] = dummy_api_key
t = DeepL::Translator.new
t.auth_key.should eq(dummy_api_key)
ENV.delete("DEEPL_AUTH_KEY")
# ENV.delete("DEEPL_AUTH_KEY")
if original_api_key
ENV["DEEPL_AUTH_KEY"] = original_api_key
else
ENV.delete("DEEPL_AUTH_KEY")
end
end

it "can set deepl api key" do
Expand Down
2 changes: 0 additions & 2 deletions src/deepl/translator.cr
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ module DeepL
end

def auth_key : String
p! @auth_key
p! ENV["DEEPL_AUTH_KEY"]?
@auth_key || ENV["DEEPL_AUTH_KEY"]? || raise ApiKeyNotFoundError.new
end

Expand Down

0 comments on commit 07b3b00

Please sign in to comment.