Skip to content

Commit

Permalink
Add test for last uncovered line of code
Browse files Browse the repository at this point in the history
Test invalid range to enter error code path

Tangentially correct an identifier in a nearby test
  • Loading branch information
jcamenisch committed Mar 23, 2023
1 parent a202c5a commit 3520208
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/env_bang_test.rb
Expand Up @@ -227,10 +227,17 @@
end

it "casts Ranges of strings" do
ENV['FLOAT_RANGE'] = 'az..za'
ENV!.use 'FLOAT_RANGE', class: Range, of: String
ENV['STRING_RANGE'] = 'az..za'
ENV!.use 'STRING_RANGE', class: Range, of: String

_(ENV!['FLOAT_RANGE']).must_equal 'az'..'za'
_(ENV!['STRING_RANGE']).must_equal 'az'..'za'
end

it "raises on invalid Range" do
ENV['BAD_RANGE'] = '1..'
_{
ENV!.use 'BAD_RANGE', class: Range
}.must_raise ArgumentError
end

it "allows default class to be overridden" do
Expand Down

0 comments on commit 3520208

Please sign in to comment.