Skip to content

Commit

Permalink
fix: use Time::Span for timeout settings
Browse files Browse the repository at this point in the history
  • Loading branch information
wout committed Apr 19, 2024
1 parent 1f8c9c0 commit f7d406a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions spec/mollie/config_spec.cr
Expand Up @@ -5,13 +5,13 @@ describe Mollie do
it "changes global the confguration" do
Mollie.configure do |config|
config.api_key = "my_key"
config.open_timeout = 1.5
config.read_timeout = 2.5
config.open_timeout = 1.5.seconds
config.read_timeout = 2.5.seconds
end

Mollie.config.api_key.should eq("my_key")
Mollie.config.open_timeout.should eq(1.5)
Mollie.config.read_timeout.should eq(2.5)
Mollie.config.open_timeout.should eq(1.5.seconds)
Mollie.config.read_timeout.should eq(2.5.seconds)
end
end
end
Expand All @@ -25,13 +25,13 @@ describe Mollie::Config do

describe "#open_timeout" do
it "has a default open timeout" do
Mollie.config.open_timeout.should eq(60)
Mollie.config.open_timeout.should eq(60.seconds)
end
end

describe "#read_timeout" do
it "has a default read timeout" do
Mollie.config.read_timeout.should eq(60)
Mollie.config.read_timeout.should eq(60.seconds)
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.cr
Expand Up @@ -36,8 +36,8 @@ Spec.after_each do
WebMock.reset
Mollie.configure do |config|
config.api_key = nil
config.open_timeout = 60
config.read_timeout = 60
config.open_timeout = 60.seconds
config.read_timeout = 60.seconds
config.currency_decimals = {
"ISK" => 0,
"JPY" => 0,
Expand Down
4 changes: 2 additions & 2 deletions src/mollie/config.cr
Expand Up @@ -10,8 +10,8 @@ module Mollie

class Config
property api_key : String?
property open_timeout : Int32 | Float64 = 60
property read_timeout : Int32 | Float64 = 60
property open_timeout : Time::Span = 60.seconds
property read_timeout : Time::Span = 60.seconds
property currency_decimals = {
"ISK" => 0,
"JPY" => 0,
Expand Down

0 comments on commit f7d406a

Please sign in to comment.