diff options
| author | Andrew Havens <[email protected]> | 2017-12-29 09:26:26 -0800 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2018-01-02 20:35:39 -0800 |
| commit | 50b36b6a8aaf9512a4699734c160fcd82c0c2ea6 (patch) | |
| tree | ad99e261dc37a67128c42434989c94bd4d3742a3 /test/sprite_spec.rb | |
| parent | 038cd2f1a5b99dbc523b8b2b42551e0261e83aa7 (diff) | |
| download | ruby2d-50b36b6a8aaf9512a4699734c160fcd82c0c2ea6.tar.gz ruby2d-50b36b6a8aaf9512a4699734c160fcd82c0c2ea6.zip | |
Check for valid file path to prevent segfault when file does not exist.
Diffstat (limited to 'test/sprite_spec.rb')
| -rw-r--r-- | test/sprite_spec.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/sprite_spec.rb b/test/sprite_spec.rb index 441ca6e..e44ea62 100644 --- a/test/sprite_spec.rb +++ b/test/sprite_spec.rb @@ -3,8 +3,12 @@ require 'ruby2d' RSpec.describe Ruby2D::Sprite do describe '#new' do + it "raises exception if file doesn't exist" do + expect { Sprite.new(0, 0, "bad_sprite_sheet.png") }.to raise_error(Ruby2D::Error) + end + it 'creates a new sprite' do - Ruby2D::Sprite.new(0, 0, "tests/media/sprite_sheet.png") + Sprite.new(0, 0, "test/media/sprite_sheet.png") end end |
