Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

end-less methods cause hangs #2892

@cromega

Description

@cromega

Subject of the issue

Ruby 3's end-less methods seem to make Rspec hang when a method raises an error.

Your environment

  • Ruby version: 3.0.1
  • rspec-core version: 3.10.1

Steps to reproduce

require 'rspec/autorun'

class Test
  def foo = (raise 'error')
  def bar = 123
end

RSpec.describe Test do
  describe '#foo' do
    it 'returns' do
      expect(Test.new.foo).to eq true
    end
  end
end
bundle exec ruby test.rb

Test
  #foo
    returns (FAILED - 1)

[hangs]

Expected behavior

This test run should produce a failure with stacktrace and error details as the example doesn't expect the error.

Actual behavior

RSpec hangs indefinitely.

Commenting out the bar method, moving it above foo or turning it into a method with the classic syntax sorts the problem.

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