Skip to content

Undefined method error in restore_original_visibility #2394

Open
@ojab

Description

@ojab

Subject of the issue

It requires running rails application and I'm not that interested to minimize testcase more since I don't use ruby-2.2 and encountered this by making PR to another project.

require 'rails'
require 'rspec'

module Dummy
  class Application < Rails::Application
  end
end

Dummy::Application.initialize!



describe 'fail' do
  subject { {} }

  it do
    expect(subject).to receive(:except)
    subject.except
  end
end

Your environment

  • Ruby version: 2.2.10
  • rspec-mocks version: 3.9.1
  • rails version: 5.2.2

Steps to reproduce

bundle exec rspec /tmp/tst.rb

Expected behavior

No errors

Actual behavior

Failures:

  1) fail is expected to receive except(*(any args)) 1 time
     Failure/Error: object_singleton_class.__send__(@original_visibility, method_name)

     NameError:
       undefined method `except' for class `Hash'
     # /home/ojab/.rvm/gems/ruby-2.2.10/gems/rspec-mocks-3.9.1/lib/rspec/mocks/method_double.rb:108:in `public'

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