[rspec-users] Testing that named_scope is defined

Helder Ribeiro helder at gmail.com
Tue May 13 18:39:11 EDT 2008

Hi guys,

I'm just beginning to use RSpec and I ran into the issue of testing a
named_scope. I'm not actually trying to test its behavior, as it's not
my code, but I wanted to test at least that it's defined. I tried
doing this:

describe Post, ".most_recent" do
  it "should be defined" do
    Post.method_defined?(:most_recent).should be_true

But it always fails, even though it *is* defined. Any idea on how to test this?

Thanks a lot!


Helder Ribeiro

Embedded Systems

"If I have not seen as far as others, it is because giants were
standing on my shoulders" -- Jeff Goll

More information about the rspec-users mailing list