Skip to content

Field 'stub' shadows an existing method in RubySMB::Dcerpc::Request while unit testing #261

Description

@ls5302

When I try to unit test my code, a simple SMB client, I get a SyntaxError error with the message field 'stub' shadows an existing method in RubySMB::Dcerpc::Request.

This only happens when I'm running the RSPEC tests, and my code executes without errors. The issue seem to occur because RSPEC has been configured by calling mock_with :rspec, and the BasicObject has a stub function defined. If the mock_with method is not called the require 'ruby_smb' is successful.

If I require 'ruby_smb' before the RSpec.configure block in the spec_helper.rb - like you have in your tests - all is well too.

Any suggestion as to how to run the unit tests without pre-requiring the GEM? Can the check be changed to @the_class.method_defined?(name, false) to ignore inherited methods?

Further problem, name_is_reserved? is also picking up stub as a reserved work because it's part of Hash.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions