Permalink
Browse files

. spec reorg, camelcase spec

  • Loading branch information...
1 parent 91608e1 commit e05ceb4067f8833a903f0075e3a2420235741acf @kschiess committed Sep 28, 2011
@@ -53,14 +53,13 @@ def reset
def add_attribute filter, action
@attributes[filter] << action
end
- protected
+
def produce_instance
name = camelcase(@klass_name.to_s)
Object.const_get(name).new
end
-
def camelcase(str)
- str.gsub(%r((^|_)\w)) { |match| match.upcase }
+ str.gsub(%r((^|_)\w)) { |match| match[-1].upcase }
end
# Modify attribute values in +instance+, setting them to what was
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe FloorManager::Employee::Template do
+ class FooBar; end
+ describe '#produce_instance' do
+ it "camelcases correctly" do
+ described_class.new(:foo_bar).produce_instance.
+ should be_instance_of(FooBar)
+ end
+ end
+end

0 comments on commit e05ceb4

Please sign in to comment.