support for dashes in guard names
This commit is contained in:
parent
492b5a4114
commit
310bc5b644
@ -82,7 +82,7 @@ module Guard
|
||||
|
||||
def get_guard_class(name)
|
||||
try_to_load_gem name
|
||||
self.const_get(self.constants.find{ |klass_name| klass_name.to_s.downcase == name.downcase })
|
||||
self.const_get(self.constants.find{ |klass_name| klass_name.to_s.downcase == name.downcase.gsub('-', '') })
|
||||
rescue TypeError
|
||||
UI.error "Could not find load find gem 'guard-#{name}' or find class Guard::#{name}"
|
||||
end
|
||||
|
@ -57,6 +57,17 @@ describe Guard do
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a name with dashes' do
|
||||
it "returns the Guard class" do
|
||||
Guard.should_receive(:try_to_load_gem) { |classname|
|
||||
classname.should == 'dashed-class-name'
|
||||
class Guard::DashedClassName
|
||||
end
|
||||
}
|
||||
Guard.get_guard_class('dashed-class-name').should == Guard::DashedClassName
|
||||
end
|
||||
end
|
||||
|
||||
context 'with an inline Guard class' do
|
||||
it 'returns the Guard class' do
|
||||
module Guard
|
||||
|
Loading…
Reference in New Issue
Block a user