Projects

Ticket #425 (closed defect: fixed)

Opened 2 years ago

Last modified 19 months ago

RSpec not working

Reported by: jens.nockert@… Owned by: martinlagardette@…
Priority: major Milestone: MacRuby 0.7
Component: MacRuby Keywords:
Cc: pontus.stromdahl@…

Description

I tried to port Datamapper/Sqlite3 to MacRuby yesterday, but without RSpec working it's hard to know what is breaking.

It (and other testing frameworks) would be a great help when porting/testing Ruby gems to MacRuby.

Attachments

eval.rb Download (81 bytes) - added by martinlagardette@… 2 years ago.
Reduced code issue (eval)
vm_eval.c.diff Download (416 bytes) - added by martinlagardette@… 2 years ago.
Proposed solution by Eloy

Change History

  Changed 2 years ago by jens.nockert@…

I saw on the mailing list that Conrad Taylor wrote last week that he was going to look at it, has that come to anything yet?

  Changed 2 years ago by mattaimonetti@…

The major problem with rspec is that it uses Kernel#caller to process the specs and currently our #caller method isn't fully compatible with 1.9's.

Regarding DM/sqlite3, because DataObjects is C based, it might not be that easy.

  Changed 2 years ago by conradwt@…

In short, as Matt mentioned, the RSpec gem requires Kernel#caller to execute the specs and MacRuby's implementation currently has 9 failures. Futhermore, the RSpec gem has a runtime dependency on test-unit-1.2.3 if you're using a VM that conforms to Ruby 1.9 language specification. In short, RSpec is a work in progress. Also, It's great that we're working on gems for MacRuby but, after logically thinking about the priorities for MacRuby, it seems that the core and language parts of the Ruby 1.9 specification should be given the highest priority.

  Changed 2 years ago by conradwt@…

@jens.nocket If you need to run specs against MacRuby VM, then I recommend using MSpec gem. I usually just install the gem with Ruby 1.9.1/1.9.2. Now, you should be able to run

Gem specs against MacRuby using CRuby.

  Changed 2 years ago by eloy.de.enige@…

I would personally recommend Bacon. MSpec is also an option, as we run the rubyspec with it, but there are still some issues we work around, and it's not meant to be as flexible as one would expect when testing applications.

It would be extra great if you could make the test suites of your gem of choice to work with Bacon and add matchers that are missing, so we can create a collection of rspec matchers others can use when moving from rspec to Bacon. Matt was already looking into this I think…

  Changed 2 years ago by mattaimonetti@…

I was.. but didn't have time to look too much into it yet. However I'm meeting with David Chelimsky tomorrow, I'll see what he's suggesting as I know he was planning on cleaning up RSpec internals.

follow-up: ↓ 8   Changed 2 years ago by honglilai@…

I confirm that RSpec is still broken, though I'm not sure whether it's for the same reasons the original reporter reported. This is what I get when trying to run the test suite for daemon_controller:

[hongli@Minato daemon_controller (master)]$ macspec -f s -c spec/daemon_controller_spec.rb 
core:in `const_missing:': uninitialized constant Formatter (NameError)
        from core:in `<main>'
        from core:in `eval:'
        from core:in `map'
        from options.rb:in `load_formatters:'
        from options.rb:in `formatters'
        from reporter.rb:111:in `formatters'
        from reporter.rb:in `start:'
        from example_group_runner.rb:in `prepare'
        from example_group_runner.rb:in `run'
        from options.rb:in `run_examples'
        from command_line.rb:in `run'

There's actually also another issue here: the backtrace doesn't always contain the line number and the filename is not absolute. While with some work I can figure out where options.rb is, I don't know which line in options.rb the exception was thrown.

in reply to: ↑ 7   Changed 2 years ago by joshua.ballanco@…

Replying to honglilai@…:

I confirm that RSpec is still broken, though I'm not sure whether it's for the same reasons the original reporter reported. This is what I get when trying to run the test suite for daemon_controller: {{{ [hongli@Minato daemon_controller (master)]$ macspec -f s -c spec/daemon_controller_spec.rb core:in `const_missing:': uninitialized constant Formatter (NameError) }}}

This looks like the same sort of error I was getting in  https://www.macruby.org/trac/ticket/564

  Changed 2 years ago by lsansonetti@…

  • owner changed from lsansonetti@… to martinlagardette@…

Thibault, can you have a look at this bug?

Changed 2 years ago by martinlagardette@…

Reduced code issue (eval)

Changed 2 years ago by martinlagardette@…

Proposed solution by Eloy

  Changed 2 years ago by lsansonetti@…

Seems good, please go ahead and commit :)

  Changed 2 years ago by martinlagardette@…

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to MacRuby 0.6

This should be fixed with r3589 :-)

Thanks for the report :-)

  Changed 2 years ago by martinlagardette@…

  • status changed from closed to reopened
  • resolution fixed deleted

  Changed 2 years ago by martinlagardette@…

Most of rspec now works, but not 100% of it, so I'll leave this one open

  Changed 2 years ago by lsansonetti@…

I reverted r3589 because it breaks irb.

  Changed 2 years ago by pontus.stromdahl@…

  • cc pontus.stromdahl@… added

Cc Me!

  Changed 19 months ago by mattaimonetti@…

  • status changed from reopened to closed
  • resolution set to fixed

rspec 2 beta seems to now be running.

$ cat test.spec 
#!/Library/Frameworks/MacRuby.framework/Versions/0.7/usr/bin/macruby
require 'rubygems'
require 'rspec'

describe "String" do
    it "should be a String" do
      "test".class.should == String
    end
end
$ ./test.spec 
.


Finished in 0.56218 seconds
1 example, 0 failures

  Changed 19 months ago by lsansonetti@…

  • milestone changed from MacRuby 0.6 to MacRuby 0.7
Note: See TracTickets for help on using tickets.