[rspec-users] ActsAsList specs

Steve Tooke steve.tooke at gmail.com
Wed Aug 15 07:52:20 EDT 2007


Hi,

How are people specifying models which act_as_list?

I'm thinking that it would be possible to check that acts_as_list
instance methods have been added to a class using something like this:

describe Page, "acts_as_list" do
  it "should act as a list" do
    Page.ancestors.should be_include(ActiveRecord::Acts::List::InstanceMethods)
  end

  it "should use page_index as position_column" do
    Page.new.position_column.should == "page_index"
  end

  it "should have scope of book_id" do
    Page.new.scope_condition.should == "book_id IS NULL"
  end
end

it at least lets you drive adding acts_as_list? Any thoughts on how I
can improve this? How anyone else has done this?

Cheers,
Steve


More information about the rspec-users mailing list