Skip to content

Commit

Permalink
Merge pull request #872 from guard/plugin-improved-type-checking
Browse files Browse the repository at this point in the history
Improve Plugin type checking
  • Loading branch information
rymai committed Jan 8, 2018
2 parents 3091066 + b8c8ca2 commit adcf25e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/guard/plugin_util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def initialize(name)
def initialize_plugin(options)
klass = plugin_class
fail "Could not load class: #{_constant_name.inspect}" unless klass
if klass.superclass.to_s == "Guard::Guard"
if klass.ancestors.include?(Guard)
klass.new(options.delete(:watchers), options)
else
begin
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/guard/plugin_util_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

context "with a plugin inheriting from Guard::Plugin" do
before do
expect(guard_rspec_class).to receive(:superclass) { ::Guard::Plugin }
expect(guard_rspec_class).to receive(:ancestors) { [::Guard::Plugin] }
end

it "instantiate the plugin using the new API" do
Expand Down

0 comments on commit adcf25e

Please sign in to comment.