Skip to content

Commit

Permalink
Added a spec related to cucumber#165
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Nov 19, 2011
1 parent b90bf60 commit 1b0e427
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cucumber/constantize.rb
Expand Up @@ -7,7 +7,7 @@ def constantize(camel_cased_word)
names = camel_cased_word.split('::')
names.shift if names.empty? || names.first.empty?

constant = Object
constant = ::Object
names.each do |name|
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
end
Expand Down
12 changes: 12 additions & 0 deletions spec/cucumber/constantize_spec.rb
@@ -0,0 +1,12 @@
require 'spec_helper'

module Cucumber
describe Constantize do
include Constantize

it "loads html formatter" do
clazz = constantize('Cucumber::Formatter::Html')
clazz.name.should == 'Cucumber::Formatter::Html'
end
end
end

0 comments on commit 1b0e427

Please sign in to comment.