diff --git a/lib/squib/input_helpers.rb b/lib/squib/input_helpers.rb
index bc1e20a..767ec42 100644
--- a/lib/squib/input_helpers.rb
+++ b/lib/squib/input_helpers.rb
@@ -89,7 +89,7 @@ module Squib
Dir.mkdir opts[:dir]
return opts
else
- raise "#{opts[:dir]} does not exist!"
+ raise "'#{opts[:dir]}' does not exist!"
end
end
module_function :dirify
diff --git a/samples/text_options.rb b/samples/text_options.rb
index a4b1604..509fafd 100644
--- a/samples/text_options.rb
+++ b/samples/text_options.rb
@@ -52,7 +52,9 @@ Squib::Deck.new(width: 825, height: 1125, cards: 3) do
text str: "Markup is also quite easy awesome",
markup: true,
x: 50, y: 1000,
- font: 'Arial 32'
+ width: 750, height: 100,
+ valign: :bottom,
+ font: 'Arial 32', hint: :cyan
save prefix: 'text_', format: :png
end
diff --git a/spec/commands/new_spec.rb b/spec/commands/new_spec.rb
index 2487108..3a5819c 100644
--- a/spec/commands/new_spec.rb
+++ b/spec/commands/new_spec.rb
@@ -1,48 +1,48 @@
require 'spec_helper'
require 'squib'
-# describe Squib::Commands::New do
-
-# describe "#process" do
-# before(:all) do
-# @old_stderr = $stderr
-# $stderr = StringIO.new
-# @oldpwd = Dir.pwd
-# Dir.chdir(File.expand_path('../../samples/_output', File.dirname(__FILE__)))
-# end
-
-# before(:each) do
-# FileUtils.rm_rf('foo', secure: true)
-# @cmd = Squib::Commands::New.new
-# end
-
-# it "raises an error if no directory was specified" do
-# expect{@cmd.process([])}.to raise_error(ArgumentError, 'Please specify a path.')
-# end
-
-# it "creates a new template on an fresh directory" do
-# @cmd.process(['foo'])
-# expect(File.exists?('foo/deck.rb')).to be true
-# end
-
-# it "creates a new template on an empty directory" do
-# Dir.mkdir('foo')
-# @cmd.process(['foo'])
-# expect(File.exists?('foo/deck.rb')).to be true
-# end
-
-# it "does not create a new template on an empty " do
-# Dir.mkdir('foo')
-# File.new('foo/somefile.txt', 'w+')
-# @cmd.process(['foo'])
-# $stderr.rewind
-# expect($stderr.string.chomp).to end_with " exists and is not empty. Doing nothing and quitting."
-# end
-
-# after(:all) do
-# $stderr = @old_stderr
-# Dir.chdir(@oldpwd)
-# end
-# end
+describe Squib::Commands::New do
+
+ describe "#process" do
+ before(:all) do
+ @old_stderr = $stderr
+ $stderr = StringIO.new
+ @oldpwd = Dir.pwd
+ Dir.chdir(File.expand_path('../../samples/_output', File.dirname(__FILE__)))
+ end
+
+ before(:each) do
+ FileUtils.rm_rf('foo', secure: true)
+ @cmd = Squib::Commands::New.new
+ end
+
+ it "raises an error if no directory was specified" do
+ expect{@cmd.process([])}.to raise_error(ArgumentError, 'Please specify a path.')
+ end
+
+ it "creates a new template on an fresh directory" do
+ @cmd.process(['foo'])
+ expect(File.exists?('foo/deck.rb')).to be true
+ end
+
+ it "creates a new template on an empty directory" do
+ Dir.mkdir('foo')
+ @cmd.process(['foo'])
+ expect(File.exists?('foo/deck.rb')).to be true
+ end
+
+ it "does not create a new template on an empty " do
+ Dir.mkdir('foo')
+ File.new('foo/somefile.txt', 'w+')
+ @cmd.process(['foo'])
+ $stderr.rewind
+ expect($stderr.string.chomp).to end_with " exists and is not empty. Doing nothing and quitting."
+ end
+
+ after(:all) do
+ $stderr = @old_stderr
+ Dir.chdir(@oldpwd)
+ end
+end
-# end
\ No newline at end of file
+end
\ No newline at end of file
diff --git a/spec/input_helpers_spec.rb b/spec/input_helpers_spec.rb
index 62dc075..56e3cb0 100644
--- a/spec/input_helpers_spec.rb
+++ b/spec/input_helpers_spec.rb
@@ -52,7 +52,29 @@ describe Squib::InputHelpers do
it "defaults to a range of all cards if :all" do
expect(@deck.send(:rangeify, {range: :all})).to eq({range: 0..1})
end
+ end
+
+ context "#fileify" do
+ it "should throw an error if the file doesn't exist" do
+ expect{@deck.send(:fileify, {file: 'nonexist.txt'}, false, true)}.to raise_error(RuntimeError,"File #{File.expand_path('nonexist.txt')} does not exist!")
+ end
+
+ it "should expand singletons when asked" do
+ expect(@deck.send(:fileify, {file: 'foo.txt'}, true, false)).to eq({file: ['foo.txt', 'foo.txt']})
+ end
+ end
+ context "#dir" do
+ it "should raise an error if the directory does not exist" do
+ expect{@deck.send(:dirify, {dir: 'nonexist'}, false)}.to raise_error(RuntimeError,"'nonexist' does not exist!")
+ end
+ end
+
+ context "#colorify" do
+ it "should parse if nillable" do
+ color = @deck.send(:colorify, {color: '#fff'}, true)[:color]
+ expect(color.to_a).to eq([1.0, 1.0, 1.0, 1.0])
+ end
end
end
\ No newline at end of file