Skip to content

Commit

Permalink
Merge pull request #289 from jgawor/ruby2.2.0
Browse files Browse the repository at this point in the history
Return nil instead of throwing exception if the type is incorrect
  • Loading branch information
opiethehokie authored Jun 20, 2016
2 parents a3b65ce + 019b492 commit e5d02f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/liberty_buildpack/jre/memory/memory_size.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ def to_s
def <=>(other)
if other == 0
@bytes <=> 0
else
fail "Cannot compare a MemorySize to an instance of #{other.class}" unless other.is_a? MemorySize
elsif other.is_a? MemorySize
@bytes <=> other.bytes
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/liberty_buildpack/jre/memory/memory_size_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
end

it 'should fail when a memory size is compared to a non-zero numeric' do
expect { described_class.new('1B') < 2 }.to raise_error(/Cannot compare/)
expect { described_class.new('1B') < 2 }.to raise_error(ArgumentError)
end

it 'should multiply values correctly' do
Expand Down

0 comments on commit e5d02f7

Please sign in to comment.