RSpec on Ruby 1.9: before(:all) (Not Yet Implemented) pending messages instead of tests

Hi.

I happily hand-compiled Ruby 1.9.0-0 into /home/shot/opt/ruby today
and I’m running into a strange error with RSpec – all my examples work
perfectly with Ruby 1.8 but are considered peding on Ruby 1.9.

My setups:

a) Ubuntu-packaged Ruby 1.8.6p36 (ruby1.8 1.8.6.36-1ubuntu3),
RubyGems 1.0.1 (rubygems 1.0.1-3) and RSpec 1.1.1 (in /var/lib/gems/1.8)

b) source-compiled Ruby 1.9.0-0 and RSpec 1.1.1
(in /home/shot/opt/ruby/lib/ruby/gems/1.9.0)

Now for the examples (two scenarios, both
with fresh shell, so the same original $PATH):

a)

[email protected]:~/work/PhD/bzr/trunk$ export
PATH=/var/lib/gems/1.8/bin:$PATH
[email protected]:~/work/PhD/bzr/trunk$ spec spec/architecture_spec.rb

Finished in 0.00815 seconds

3 examples, 0 failures

b)

[email protected]:~/work/PhD/bzr/trunk$ export
PATH=/home/shot/opt/ruby/bin:$PATH
[email protected]:~/work/PhD/bzr/trunk$ spec spec/architecture_spec.rb
PPP

Pending:
ArtDecomp::Architecture before(:all) (Not Yet Implemented)
ArtDecomp::Architecture before(:all) (Not Yet Implemented)
ArtDecomp::Architecture before(:all) (Not Yet Implemented)

Finished in 0.012114249 seconds

3 examples, 0 failures, 3 pending

How can I bugtrack/fix this?

I had to patch RSpec in the below manner to get it running
on Ruby 1.9, but I doubt these fixes can be the culprit.

— lib/spec/runner/options.rb.orig 2007-12-27 16:36:03.000000000
+0100
+++ lib/spec/runner/options.rb 2007-12-27 16:36:28.000000000 +0100
@@ -102,7 +102,7 @@
def colour=(colour)
@colour = colour
begin; \

  •      require 'Win32/Console/ANSI' if @colour && PLATFORM =~ 
    

/win32/;
+# require ‘Win32/Console/ANSI’ if @colour && PLATFORM =~
/win32/;
rescue LoadError ;
raise “You must gem install win32console to use colour on
Windows” ;
end
— lib/spec/matchers/be.rb.orig 2007-12-27 16:30:51.000000000
+0100
+++ lib/spec/matchers/be.rb 2007-12-27 16:32:14.000000000 +0100
@@ -124,7 +124,8 @@
def parse_expected(expected)
if Symbol === expected
@handling_predicate = true

  •        ["be_an_","be_a_","be_"].each do |@prefix|
    
  •        ["be_an_","be_a_","be_"].each do |at_prefix|
    
  •          @prefix = at_prefix
             if expected.starts_with?(@prefix)
               return "#{expected.to_s.sub(@prefix,"")}".to_sym
             end
    

– Shot

Shot (Piotr S.):

I happily hand-compiled Ruby 1.9.0-0 into /home/shot/opt/ruby today
and I’m running into a strange error with RSpec – all my examples work
perfectly with Ruby 1.8 but are considered peding on Ruby 1.9.

FWIW, I get the same result with this simplest spec:

describe Array do
it ‘should work’ do
a = [1, 2]
a.first.should == 1
end
end

RSpec 1.1.1 on Ruby 1.8 – 1 example, 0 failures.
RSpec 1.1.1 on Ruby 1.9 – 1 example, 0 failures, 1 pending.

– Shot

On Dec 27, 2007 3:18 PM, Shot (Piotr S.) [email protected] wrote:

a = [1, 2]
a.first.should == 1

end
end

RSpec 1.1.1 on Ruby 1.8 – 1 example, 0 failures.
RSpec 1.1.1 on Ruby 1.9 – 1 example, 0 failures, 1 pending.

You should probably bring this up on the rspec-users list (I’m copying
this reply there).

This is most likely either:

  1. A bug in Ruby 1.9 - At least one bug was reported just before the
    1.9.0 release which related to using module_eval inside a method.
    I’ve looked at the RSpec code and it’s using instance_eval inside a
    method, so there might be a related bug. I tried to come up with a
    simplified program which evidenced a failure, but couldn’t, but I
    didn’t try all that hard.

  2. RSpec running into a subtle 1.9 incompatible language change. I
    didn’t see anything obvious, but that’s not to say it’s not there.


Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

On Dec 29, 2007 7:44 AM, David C. [email protected] wrote:

     begin; \
         @handling_predicate = true

problems you might be experiencing with 1.9 (unless win32console does
not yet support 1.9). Feel free to submit a ticket to the tracker on
this one.

David, will not be better set @colour back to false if the require
failed, instead of raising the exception?

In that way, colour is automatically disabled, the user warned and
when win32console gets updated for 1.9, all users will be happy :smiley:


Luis L.
Multimedia systems

A common mistake that people make when trying to design
something completely foolproof is to underestimate
the ingenuity of complete fools.
Douglas Adams

On Dec 27, 2007 4:28 PM, Shot (Piotr S.) [email protected] wrote:

Hi.

I happily hand-compiled Ruby 1.9.0-0 into /home/shot/opt/ruby today
and I’m running into a strange error with RSpec – all my examples work
perfectly with Ruby 1.8 but are considered peding on Ruby 1.9.

Pending:
ArtDecomp::Architecture before(:all) (Not Yet Implemented)
ArtDecomp::Architecture before(:all) (Not Yet Implemented)
ArtDecomp::Architecture before(:all) (Not Yet Implemented)

Finished in 0.012114249 seconds

3 examples, 0 failures, 3 pending

How can I bugtrack/fix this?

RSpec’s tracker can be found at http://rspec.lighthouseapp.com.

The “Not Yet Implemented” issue you had is fixed in trunk now.

+# require ‘Win32/Console/ANSI’ if @colour && PLATFORM =~ /win32/; \

  •        ["be_an_","be_a_","be_"].each do |at_prefix|
    
  •          @prefix = at_prefix
             if expected.starts_with?(@prefix)
               return "#{expected.to_s.sub(@prefix,"")}".to_sym
             end
    

The change to be.rb has already been applied, but not the change to
options.rb. I’m not sure I see any relationship between that and
problems you might be experiencing with 1.9 (unless win32console does
not yet support 1.9). Feel free to submit a ticket to the tracker on
this one.

Cheers,
David

David C.:

On Dec 27, 2007 4:28 PM, Shot (Piotr S.) [email protected] wrote:

I happily hand-compiled Ruby 1.9.0-0 into /home/shot/opt/ruby today
and I’m running into a strange error with RSpec – all my examples work
perfectly with Ruby 1.8 but are considered pending on Ruby 1.9.

How can I bugtrack/fix this?

RSpec’s tracker can be found at http://rspec.lighthouseapp.com.

Right; I’m not too fluent in RSpec yet (in particular, I didn’t use
any pending specs yet), so I just wanted to ask around before filing
a ticket.

The “Not Yet Implemented” issue you had is fixed in trunk now.

Most appreciated! I’ll wait for RSpec 1.1.2
before switching to Ruby 1.9 in full then.

BTW: The tracker says 1.1.2 ‘is 11 months late’ and ‘Expected: Jan 17th,
2007’. Is 1.1.2 expected in two weeks’ time and it should be 2008 there?

I had to patch RSpec in the below manner to get it running
on Ruby 1.9, but I doubt these fixes can be the culprit.

     end

The change to be.rb has already been applied, but not the change
to options.rb. I’m not sure I see any relationship between that and
problems you might be experiencing with 1.9 (unless win32console does
not yet support 1.9).

Sorry for not explaining this one. This is with using spec -c -D u on
Ubuntu (with diff-lcs installed) – I keep running into an ‘uninitialized
constant Spec::runner::Options::PLATFORM’ error, hence the simplest
above workaround. Might be a bug in Ruby 1.9 not scoping the class
constants properly, though.

Feel free to submit a ticket to the tracker on this one.

#215 filed:
http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/215

– Shot

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs