lib/entityjs/commands/test.rb in entityjs-0.4.3 vs lib/entityjs/commands/test.rb in entityjs-0.4.4
- old
+ new
@@ -6,12 +6,16 @@
if !Dirc.game?
return 2
end
tests = []
+
+ if name.nil?
+ return 4
+ end
- if name.class == Array
+ if name.is_a? Array
tests = name[1..-1]
name = name.first
end
@@ -42,11 +46,11 @@
if File.exists?(filename)
return 3
end
- test_name = filename.split('_test.').shift
+ test_name = filename.split('_test.').first
File.open(filename, 'w') do |f|
f.write("module('#{test_name}');")
@@ -55,10 +59,10 @@
end
f.close
end
- puts "Created test: tests/#{filename}"
+ puts "Created test: #{filename}"
Dir.chdir(Dirc.game_root)
return 0
end
\ No newline at end of file