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

Already on GitHub? Sign in to your account

Handle deprecation of assert_block safely #24

Merged
merged 1 commit into from May 27, 2013

Conversation

Projects
None yet
2 participants
Contributor

rsl commented May 27, 2013

MiniTest 4.6.0 and higher no longer has assert_block as a method [opting for assert(yield, message)] https://github.com/seattlerb/minitest/blob/master/History.txt#L134-L140

This enables users with older MiniTest to still use assert_block if it's there and the newer format if it's not.

Not sure how to write a test for this as it is a dependency-based issue.

@rmm5t rmm5t added a commit that referenced this pull request May 27, 2013

@rmm5t rmm5t Merge pull request #24 from rsl/master
Handle deprecation of assert_block safely
7a5b224

@rmm5t rmm5t merged commit 7a5b224 into thoughtbot:master May 27, 2013

1 check passed

default The Travis CI build passed
Details
Contributor

rsl commented May 27, 2013

super fast. thanks.

Collaborator

rmm5t commented May 27, 2013

Thanks! I merged this in to give you credit for bringing it to our attention, but what's stopping us from just avoiding the assert_block method altogether? Is there a reason we can't just use assert and avoid the safe_assert_block?

Contributor

rsl commented May 27, 2013

hrm. i actually didn't think to do that at all. i think in the back of my head assert was modified to take assert_block's place. makes sense that assert out of the box would do that. feel stupid for not having thought of it. ;)

Contributor

rsl commented May 27, 2013

i assumed no one used plain assert because it used to not work. so i wanted to make sure those users were supported but yeah... yeah. ;)

Collaborator

rmm5t commented May 27, 2013

I tried a quick transition to just using assert but the test suite fails because it expects a different format of failed test output for that assertion. If it's something you're interested in investigating, much appreciated. Otherwise, I'll come back to it at some later date, probably.

Contributor

rsl commented May 27, 2013

poking it now.

Contributor

rsl commented May 27, 2013

there's a lot of places that can/do define assert there. stdlib's test/unit. rubygem test-unit. minitest. all of which have some differences in versions. looks like it might be bugger trying to unify that in a single call to assert.

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