specs fail a lot with ruby 1.9.1 #37

Closed
brainlag opened this Issue Aug 22, 2009 · 13 comments

Comments

Projects
None yet
3 participants

There are serveral problems with ruby 1.9.1
First it will not run any specs at all because instance vars are not allowed as block arguments

semantic_form_for(@new_post) do |@builder|
                                 ^

Im not sure if this is a typo or it makes any sense with ruby 1.8.6 because these appear only 2 times.

After fixing this nearly all specs fail because of missing methods errors.
The missing methods are all defined at line 43-51 in formtastic_spec.rb so I assume there is a scoping problem which I was unable to get around.

Owner

justinfrench commented Aug 25, 2009

Thanks, I don't have a multi-ruby environment set up right now, so I've tagged this with 1.0, which means I'll lok at it after 0.9 ships, assuming no one else has picked it up in the meantime.

Contributor

grimen commented Aug 31, 2009

I managed to get the specs running with some trix, but it's quite hilarious:

F...FF........FFFFFFFFFFFFFFFFFFFFFF.FFFF.FFFFFFFFFFFFFFFF.FFFFFFFFFFFFFFFFFFFF...FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF...FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF..

I'm working on it now though. =) Weeee

Owner

justinfrench commented Aug 31, 2009

I couldn't even get them to run at all under 1.9.x, Rake kept complaining about the require spec/rake/spectask or whatever it is. So you're doing better than me!

Contributor

grimen commented Sep 1, 2009

Yes, I learned how to solve such errors yesterday while fixing a very broken Rails plugin that I loved to use. Usually, you only have to declare which gem and version you are using like this:

require 'rubygems'

gem 'nokogiri', '>= 1.0.0'

# now, require libs here...

I'm trying to fix the bad bad RSpec errors cuased by maybe too much meta-programming, because the estack trace is like greek. I started off with trying jruby first as a warm up, and managed to get from 18 errors to aprox 5. Most of em was because of invalid selector input to nokogiri which only works with an old libxml2 version that is more whiny. Here you got the errors that I cannot touch now:

http://pastie.org/601101

...but look on error 2 and 3 - my eyes tells me those specs should not pass. Also , the last incorrect specs testing if classes for object id gets generated - but that is very invalid markup, so if that is used now maybe it should be designed in a valid way.

OK, back to the 1.9 debugging... =)

Contributor

grimen commented Sep 1, 2009

Actually, the issue was that I used the newer rspec_hpricot_matchers (from github) that dropped hpricot for the faster and more robust nokogiri, which pointing out the invalid markup too. All specs works for jruby now with the older version of rspec_hpricot_matchers.

Contributor

grimen commented Sep 4, 2009

Just to mention, I spent a pair of hours on this but never got any longer on the failing tests as ruby-debug is not supported for 1.9.1, and therefore very hard to debug (as I use to). =( It was worth a try though! The good news - maybe - is that it's the same error recurring all over the place.

brainlag commented Sep 4, 2009

Maybe you can give this version of ruby-debug a try, should work with ruby 1.9
http://github.com/mark-moseley/ruby-debug/tree/master

Contributor

grimen commented Sep 4, 2009

OK, I'll try that. Thanks for the tip!

Contributor

grimen commented Sep 4, 2009

Solved! =D

rake
(in /Users/Jonas/Development/forks/formtastic)
............................................................................................................................................................................................................................................................................................................................................................................................

Finished in 7.839581 seconds

380 examples, 0 failures

Quite trivial changes as soon as I got the big picture:
http://github.com/grimen/formtastic/commit/bd271597fc223e64a7f558ceb5306738987e1492

brainlag commented Sep 4, 2009

Great Work! Does it still work with ruby 1.8.x?

Contributor

grimen commented Sep 4, 2009

Yes, I tested with 1.8.7 - so I'm like 99.9% sure 1.8.6 works too.

Owner

justinfrench commented Sep 6, 2009

Awesome work! I have 1.8.6 handy, so I'll pull this down and have a play.

Contributor

grimen commented Sep 6, 2009

Justin, note that both last 2 commits are needed - the previous one got the specs start running.

This issue was closed.

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