-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This type correctly checks the type for sizes. It now allows specifying the maximum_object_size_in_memory in MBs rather than KBs. For correctness we now also check for the full string which means we no longer allow -1 KB or 1 KBB.
- Loading branch information
Showing
3 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Squid::Size' do | ||
it { is_expected.to allow_value('1 KB') } | ||
it { is_expected.to allow_value('1 MB') } | ||
it { is_expected.to allow_value('10 KB') } | ||
it { is_expected.to allow_value('9876543210 KB') } | ||
it { is_expected.not_to allow_value('-1 KB') } | ||
it { is_expected.not_to allow_value('1 kB') } | ||
it { is_expected.not_to allow_value('1 Kb') } | ||
it { is_expected.not_to allow_value('1 Mb') } | ||
it { is_expected.not_to allow_value('1 KBB') } | ||
it { is_expected.not_to allow_value('a KBB') } | ||
it { is_expected.not_to allow_value('1KB') } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
type Squid::Size = Pattern[/^\d+ [KM]B$/] |