summaryrefslogtreecommitdiffhomepage
path: root/test/image_spec.rb
diff options
context:
space:
mode:
authorTom Black <[email protected]>2017-04-26 22:16:19 -0400
committerTom Black <[email protected]>2017-04-28 18:08:26 -0400
commit8d39db97fd82e99015d31fa38436fea6c1530a87 (patch)
treef5303da94a6986cc6d72371d125755eb3e282ad9 /test/image_spec.rb
parent10d9acbe39a6e649e8752c3d06d1157d43b6e73a (diff)
downloadruby2d-8d39db97fd82e99015d31fa38436fea6c1530a87.tar.gz
ruby2d-8d39db97fd82e99015d31fa38436fea6c1530a87.zip
Add `File.exists?` to MRuby
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!
Diffstat (limited to 'test/image_spec.rb')
-rw-r--r--test/image_spec.rb11
1 files changed, 11 insertions, 0 deletions
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