RSpec for Ruby 1.9 patches, set 1
Reported by Igal Koshevoy | January 7th, 2008 @ 07:45 PM
Below is an incomplete patch to RSpec r3209 for Ruby 1.9.0-0. With this patch, all specs in /rspec pass with Ruby 1.8.6, and all but 7 pass with 1.9.0-0. I haven't modified /rspec_on_rails yet and don't intend to until /rspec passes.
Because Ruby 1.9.0-0 lacks working versions of RCov, Heckle and Hpricot, you'll need to set these environmental variables before running the RSpec specs to disable examples that depend on these libraries:
export NO_RCOV=true; export NO_HECKLE=true; export NO_HPRICOT=true
It would be useful if someone that understands RSpec better than me can confirm that the changes I've made thusfar make sense or propose alternatives. I've deliberately minimized the changes in my code so that this patch is easier to read and merge, which is why the indentations are off in spots. Most of the changes are straight-forward, but some are workarounds for Ruby 1.9 bugs (e.g., "modref"). I think that the remaining spec failures may be related to 1.9 bugs, so ideally we should isolate these bugs and report them to the Ruby team, and mark all the workarounds so that we can easily remove them later.
-igal
Comments and changes to this ticket
-
David Chelimsky January 30th, 2008 @ 05:30 AM
- → State changed from new to open
- → Assigned user changed from to David Chelimsky
Having some trouble applying this patch. Can you please recreate it from inside trunk?
-

Igal Koshevoy January 30th, 2008 @ 12:42 PM
David,
Sorry for the lack of progress, been really busy. Here's a quick update.
I've been holding off on uploading patches I've made since that last upload and limited the time I've spent on this until I could get a newer, more stable version of 1.9 to patch against with fewer workarounds, because there seems to have been some effort to resolve some of the bugs I was blocked by. However, every version I've tried since 1.9.0.0 has had some showstopper bug that's gotten in the way -- for instance, recent versions of trunk don't work with rubygems, which makes it hard to run specs.
In light of this situation, my earlier hope of uploading a big patch that'd resolve the 1.9 issues is unrealistic. Instead I'll start uploading small tickets with standalone patches of code that genuinely belong in RSpec. For example, there's a few cases where 1.9's stricter syntax checks throw exceptions on dubious code that clearly shouldn't have worked at all in 1.8. Don't worry, none of the ones I ran across seemed serious, or I'd have sent patches sooner.
Once these general-purpose patches are submitted, I'll update this ticket with my current set of ugly workarounds for getting more specs to pass. However, those awkward hacks probably don't belong in the standard version of RSpec, but rather in a patchset or named branch for those wanting to use 1.9.
Sound okay?
-igal
-
David Chelimsky January 30th, 2008 @ 01:58 PM
Keeping the patches small is a much better approach.
As for keeping things separate, I have a couple of thoughts about that. I think maintaining a separate branch would be a challenge for us and I'd prefer to avoid it.
Given that 1.9 is a development release anyhow, and therefore subject to ongoing changes from release to release, I'd propose that we keep ALL 1.9 specific changes in a separate directory that gets loaded when running 1.9.
For example, right now there is a small change in lib/spec/example/example_methods.rb. That change would move to lib/1.9/spec/example/example_methods.rb.
Thoughts?
-

Michael Klishin January 30th, 2008 @ 05:53 PM
Related thing: I made Hpricot compile on Ruby 1.9 and fixes 14 of initial 21 failing tests. The remaining 7 share the problem I tracked down and probably going to finish with soon.
-
-

Michael Klishin January 30th, 2008 @ 06:54 PM
David,
It is not done. 7 tests are still failing. If you want to have an idea what should be changed to get Hpricot compiled and work in most cases, you can refer to my blogpost on that.
But I think I need some more work to be done on it before I post nicely wrapped patch.
Works for you?
-

Michael Klishin February 6th, 2008 @ 01:22 PM
Guys and gals,
k, I've got Hpricot compiling and running test suite 100% green on 1.9. My patch sent to bug tracker and _why by email but before we get an Hpricot update, I'd like to keep changes here as well.
Blogpost on porting (expects updates as _why gives me some feedback).
What else should be ported to 1.9 beside rcov?
-

-

Igal Koshevoy February 7th, 2008 @ 06:10 PM
Thanks all for the extra patches and effort. I'm sorry for not being as
involved as I wanted to be, I've had too much other stuff going on. I'll
take some time out on Saturday to catch up on this thread, rebase my
code, and upload patches to avoid blocking this any further.
Say, what SVN revision of Ruby 1.9 have you found to work best? I've had
the best luck with the initial 1.9.0.0 release, while the later SVN-only
releases have had various issues that make them impossible to use for
this. I'd like to be able to use a newer version because it may
incorporate fixes that eliminate the need for some of my workarounds,
but haven't found one that works well enough.
-igal
-

Igal Koshevoy February 7th, 2008 @ 06:20 PM
Michael,
Thank you for the work on porting Hpricot.
What else should be ported to 1.9 beside rcov?
Last time I checked, rcov and heckle still needed to be ported to 1.9.
I've been cheating by skipping the examples that rely on these by adding
a feature that looks for the environmental variables NO_HECKLE and NO_RCOV.
-igal
-

Michael Klishin February 7th, 2008 @ 08:01 PM
Igal,
I'd be using 1.9.0 until Ruby team releases Ruby 1.9.1. If possible, of course.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Behaviour Driven Development for Ruby.
