Radrails and RSpec

Hi all,

Does anyone know how to get radrails to use RSpec specs instead of tests?

Cheers

Daniel,

   > Does anyone know how to get radrails to use RSpec specs instead of tests?

Give a try to the simply_bdd plugin.
   http://svn.techno-weenie.net/projects/plugins/simply_bdd/README

It makes using RSpec a lot easier: you run rspec code like normal
tests (see the example in the README page), and it works fine with
autotest.

Not shown in the README example is the need to use
    require 'spec'
to access the should_** magic.

Example:

file: test/unit/a_user_test.rb
  require File.dirname(__FILE__) + '/../test_helper'
  require 'spec'

  context "A User with no name" do
     def setup
       @user = User.new
     end

     specify "should be invalid" do
       # assert !@user.valid? # std way
       @user.should_not_be_valid # rspec way
     end
  end

Alain

"It makes using RSpec a lot easier"

Its best not to confuse Rick's plugin with RSpec - they aren't the same
and whilst simply bdd is neat, it doesn't give you the full power of
RSpec (such as the should_ expectations).

Scratch that, didn't read the above post properly.

If you want to use RadRails though, can't you still just use the
console to run your tests?

Its best not to confuse Rick's plugin with RSpec - they aren't the same

  > and whilst simply bdd is neat, it doesn't give you the full power of
  > RSpec (such as the should_ expectations).

Read my msg again, and the example I gave: it uses a should_* expectation.

Alain

Thanx for the insight. I’ve been using simply_bdd for this but didn’t even think to require spec.

I’m not sure that I understand exactly what’s happening here
though. If I require spec, which context method is being
called? simply_bdd or rpsec? Does it make a difference?

Luke, I can use consle for testing, but I rather use it in RadRails when I’m developing there.

I guess bdd just reasonates with me, and I’d like to use it. It
seems that requiring spec in the test files would give me the best of
both worlds. I can use the should_** methods and normal assert*
methods.

Thanx again for the pointers.

Cheers

Daniel