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

implement our own around with multiple calls and intuitive interface #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

grosser
Copy link
Owner

@grosser grosser commented Jun 1, 2015

No description provided.

@grosser
Copy link
Owner Author

grosser commented Jun 2, 2015

@splattael what do you think about this approach ?

@splattael
Copy link

@grosser I think trading rspec-semantics for a much simpler implementation is fair! :)
What about minitest-hooks?

@grosser
Copy link
Owner Author

grosser commented Jun 2, 2015

not using rspec & rails(around_action) & rack(app.call) semantics turns this line super() { instance_exec(block, &inside) } into instance_exec(block, &inside) so very little benefit + I think it's far easier then telling people they have to call super with the block we pass in ...

So I prefer that to the way minitest-hooks does it + I like having multiple before/after/around blocks instead of just overwriting without warning.

Also minitest-hooks implements all in a broken way, so I'd rather not have that then have a broken implementation ...

describe 111 do
  before(:all) { puts 1 }
  after(:all) { puts 4 }

  describe 11 do
    before(:all) { puts 2 }
    it "surprise" do
      puts 3
    end
  end
end

1
4
1
2
3
.4

vs rspec (intuitive 1 before/after for all)

1
2
3
.4

@splattael
Copy link

@grosser gotcha!

I'm still not sure about the before/after semantics. As far as I can see we have 3 different now:

  • RSpec (RSpec & minitest-around + Fibers)
  • Ruby (minitest-hooks)
  • maxitest (pre-Fiber minitest-around)

I'm lost here :-(

@grosser
Copy link
Owner Author

grosser commented Jun 2, 2015

Fibers are most 'correct', but they don't play nice with Thread.current so
you can run into nasty issues ...

maxitest approach / pre-fibers is maybe better since it works unless you
mix before and around ...

I don't like the hooks approach because it's a never-seen-before way of
doing things + exposes unnecessary implementation detail.

I guess the before/after :all is also 'ok' since it's a step forward from
not having these tools at all ...

I guess I'll include minitest-hooks but make it use test.call semantics +
multiple blocks ... that should only be very small changes ...

On Mon, Jun 1, 2015 at 11:48 PM, Peter Suschlik notifications@github.com
wrote:

@grosser https://github.com/grosser gotcha!

I'm still not sure about the before/after semantics. As far as I can see
we have 3 different now:

  • RSpec (RSpec & minitest-around + Fibers)
  • Ruby (minitest-hooks)
  • maxitest (pre-Fiber minitest-around)

I'm lost here :-(


Reply to this email directly or view it on GitHub
#8 (comment).

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

Successfully merging this pull request may close these issues.

2 participants