From 8d39db97fd82e99015d31fa38436fea6c1530a87 Mon Sep 17 00:00:00 2001 From: Tom Black Date: Wed, 26 Apr 2017 22:16:19 -0400 Subject: Add `File.exists?` to MRuby MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also enables file checking to the `Image` class for MRI and MRuby (on the web, a “failed to load resource” already appears). Also, all exceptions will now be printed in MRuby, yay! --- test/image_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 test/image_spec.rb (limited to 'test') diff --git a/test/image_spec.rb b/test/image_spec.rb new file mode 100644 index 0000000..43950c9 --- /dev/null +++ b/test/image_spec.rb @@ -0,0 +1,11 @@ +require 'ruby2d' + +RSpec.describe Ruby2D::Image do + + describe '#new' do + it "raises exception if image file doesn't exist" do + expect { Image.new(0, 0, 'bad_image.png') }.to raise_error(Ruby2D::Error) + end + end + +end -- cgit v1.2.3