add more tests

This commit is contained in:
David Dollar
2012-01-28 18:48:26 -05:00
parent 7cb73f5c36
commit 224fe94dc2
15 changed files with 208 additions and 40 deletions
+2 -7
View File
@@ -6,9 +6,8 @@ module Foreman::Helpers
# classify('job-name') # => 'JobName'
def classify(dashed_word)
dashed_word.split('-').each { |part| part[0] = part[0].chr.upcase }.join
end
end # Tries to find a constant with the name specified in the argument string:
# Tries to find a constant with the name specified in the argument string:
#
# constantize("Module") # => Module
# constantize("Test::Unit") # => Test::Unit
@@ -28,10 +27,6 @@ module Foreman::Helpers
def constantize(camel_cased_word)
camel_cased_word = camel_cased_word.to_s
if camel_cased_word.include?('-')
camel_cased_word = classify(camel_cased_word)
end
names = camel_cased_word.split('::')
names.shift if names.empty? || names.first.empty?
@@ -47,4 +42,4 @@ module Foreman::Helpers
end
constant
end
end
end