rspec/rspec-core

drb support

Closed this issue · 21 comments

Add a --drb command line switch with an option for specifying port.

I'm working on this

This will require a change and some extensions to Spork: http://github.com/timcharper/spork/issues/issue/27

The relevant issue to RSpec is what interface to expose for Spork. I've done a bit of refactoring to RSpec (unpushed) to separate DRb execution from in-process execution, but it's definitely not yet in a good state.

This is a little harder than I expected due to RSpec API changes. I was hoping to avoid forking Spork, but I can't see an elegant way to integrate the two otherwise, due to the way Spork loads its TestFramework adapters.

I'm making good progress on this. The code in my branch is still a bit of a mess as I find my way around, but functionality is moving forwards (the existing specs and features still pass). Hopefully tomorrow I'll have RSpec in a good enough state I can start making the patches to Spork. How much I'll oscillate between the two to integrate them, however, is anyone's guess. I only have tomorrow morning to work on this really, and a busy weekend, so there's a chance it won't be done until Monday.

The only major interface change I can think of so far is Rspec::Core::Runner#run now takes the output and error streams.

The biggest obstacle I've come up against is the use of singleton Configuration and World objects. Because the DRb specs run examples inside themselves (in the same process), this demands a bit of instance variable surgery to prevent interference. I can see the appeal of the class methods for the configuration, but I suspect they will need decoupling from the Runner instances somehow.

What if those methods accepted an optional scope argument?

Rspec.configure :scope => :drb do; end
Rspec.configuration :scope => :drb

Would that help?

Yes I think that would work! It would have to be possible to overwrite/reset a configuration in a scope. Then the code would either have to select the configuration before creating the runner, or pass the scope into it for the Runner to look it up (easier, can't say if it'd be better or not).

Commenting so I get updates on this -- spork for Rails 3 would be great.

Hey Ashley, Rob, et al - been focusing what little spare time I have to getting the rspec-rails dev environment to work better so others can contribute. That's in a good spot, so I'll plan on focusing on spork integration this week.

Thanks David - I've been consumed by client work (what I'm doing right now in fact) - and it's been playing on my mind that this has been sitting as WIP for so long. I think by and large all the pieces are there, but it needs serious refactoring on both sides!

I won't have time to look at this until later today at the earliest - are all of the pieces in github repos that I can see?

Yep, in feature branches in my branches of rspec-core and spork. I've updated the Spork ticket with a note too just FYI (in case you aren't watching that ticket): http://github.com/rspec/rspec-core/issues/issue/2

Relevant branches:

http://github.com/ashleymoran/rspec-core/tree/issue_2_drb_support
http://github.com/ashleymoran/spork/tree/issue_27_rspec2_support

Great. Thanks. I'll follow up soon (in a day or so).

Any update on this?

I haven't done anything more on it recently. Unfortunately, I've been fully booked by a client on a Rails 2.3 project, which is taking up all my coding time. I'll happily resume when that quiets down, but there's no indication that will be soon.

This will be resolved before rails-3 goes final. Hopefully sooner, but this is clearly a must have.

OK - this is my main priority right now. Ashley, I merged your changes to a branch (http://github.com/rspec/rspec-core/tree/issue_2_drb_support), but a LOT has changed in rspec-core since you wrote them, so things are a bit of a mess right now (specs run, but lots of failures and odd output). Ping me in #rspec on freenode if you have a chance. Until then, I'll keep plugging at this.

Fixed!!!!! Merged!!!!!! Thanks @ashleymoran:

http://github.com/rspec/rspec-core/commit/f99c34ea2fa02ae2d6e02cc68505a3f5114f30f6

I've made a number of changes since to get things to work, and I'm still refactoring a bit more, but I got it to a point where it seemed like a good idea to merge to master. Release coming soon.

Lol, no worries, I think you did the hard work making it work after I let my code had rust for who knows how long! I may at some point come back to refactor the ugly bits I cobbled together...

Just glad to know when I get back to Rails 3 I'll have Spork to play with :-)

Hey should this be closed now, or is it still in progress?

Closed - are you experiencing any trouble?

No, haven't tried it yet. I just have problems understanding what current status is from github issues sometimes. :)