Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in_sub_process doesn't seem to work with around hook #498

Open
nomasprime opened this issue Apr 19, 2021 · 4 comments
Open

in_sub_process doesn't seem to work with around hook #498

nomasprime opened this issue Apr 19, 2021 · 4 comments

Comments

@nomasprime
Copy link

nomasprime commented Apr 19, 2021

Example passes with pseudo before hack:

    context "with empty block" do
      let(:before) { described_class.send(:configure) {} }

      describe ".configuration" do
        it "returns Configuration instance" do
          in_sub_process do
            before
            expect(described_class.send(:configuration)).to be_an_instance_of(described_class::Configuration)
          end
        end
      end

Example seems to be inappropriately marked pending with around hook:

    context "with empty block" do
      around(:each) do |example|
        in_sub_process do
          described_class.send(:configure) {}
          example.run
        end
      end

      describe ".configuration" do
        it "returns Configuration instance" do
            expect(described_class.send(:configuration)).to be_an_instance_of(described_class::Configuration)
        end
      end

Expect this to also pass.

Your environment

  • Ruby version: 2.6.6
  • rspec-support version: 3.10.2
@pirj
Copy link
Member

pirj commented Apr 19, 2021

That confirms my experience, thanks for reporting.
Do you think this can be fixed, @nomasprime ?

@nomasprime
Copy link
Author

@pirj sure.

My RSpec internals knowledge isn't great but I'll try to have a look when I have more time.

Maybe one of the authors would have a better idea.

@pirj
Copy link
Member

pirj commented Apr 19, 2021

Just by glancing over, I'd suggest taking a look at run_around_example_hooks_for. Pending.mark_pending! might be an interesting place to peek at.

@JonRowe
Copy link
Member

JonRowe commented Apr 19, 2021

I can't replicate this atm to confirm (I get a different error) but this will be because of how hooks are run, you'll need to tell the parent process the example has been run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants