RSpec 2.5 not seeing MiniTests?

I originally tried using the upgrade instructions on relish/core/upgrade
but eventually stripped it down to a couple files and still cannot get
RSpec to pick up my minitest tests. I don’t actually use
describe/should syntax, I am basically using Test::Unit but wanted the
nice html formatting RSpec provides. I included both styles here for
illustration.

####### On rspec1.2.9 it would have looked like #######

testpass.rb

require ‘spec/test/unit’

class TestPass01 < TestUnit::Unit::TestCase
def test_pass
assert(true)
end
end

describe ‘testpass02’ do
it ‘passes’ do
true
end
end

command/output

C:\tests\spec>spec testpass.rb

Finished in 0.23 seconds
2 examples, 0 failures

Neat, they’re both found…

####### current config #######
winXP
ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
rspec (2.5.0)
rspec-core (2.5.1)
rspec-expectations (2.5.0)
rspec-mocks (2.5.0)

spec_helper.rb

puts ‘–>in spec_helper.rb’

RSpec.configure do |config|
config.run_all_when_everything_filtered = true
config.expect_with :stdlib # => Test::Unit or MiniTest
end

TestPass01.rb

puts ‘–>in TestPass01.rb’

require ‘minitest/unit’ #got same behavior with ‘minitest/autorun’

class TestPass01 < MiniTest::Unit::TestCase
puts ‘–>in class TestPass01’

def test_pass_spec
puts ‘–>in test test_pass_spec’
assert(true)
end

end

describe ‘testpass02’ do
it ‘passes’ do
puts ‘–>in test testpass02’
true
end
end

command line/output

C:\tests\spec>rspec -r spec_helper.rb TestPass01.rb
–>in spec_helper.rb
–>in TestPass01.rb
–>in class TestPass01
–>in test testpass02
.

Finished in 0 seconds
1 example, 0 failures

It’s finding testpass02 but not testpass01. I have been banging my head
against this for a couple days. Any help is greatly appreciated…

On Apr 12, 2011, at 1:59 PM, josh wall wrote:

testpass.rb

true

rspec-core (2.5.1)
config.expect_with :stdlib # => Test::Unit or MiniTest

true
–>in test testpass02
.

Finished in 0 seconds
1 example, 0 failures

It’s finding testpass02 but not testpass01. I have been banging my head
against this for a couple days. Any help is greatly appreciated…

RSpec-2 does not support running subclasses of Test::Unit::TestCase or
MiniTest::Unit::TestCase. Just change the TestCase class declarations to
calls to describe and you’re good to go - you’ll have access to all of
the assertions, as you’ve seen in your example.

HTH,
David

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