Skip to content

Latest commit

 

History

History
102 lines (73 loc) · 2.61 KB

README.textile

File metadata and controls

102 lines (73 loc) · 2.61 KB

woulda

Testing is love. Especially when done with Shoulda. Shoulda makes testing your Rails app pretty easy.

There are tons of Rails plugins and gems out there. It should be easy to test your Rails app that uses these as well. That kind of support doesn’t really belong in Shoulda itself, though.

That’s where Woulda comes in.

Installing

It’s available as a gem:

gem install seanhussey-woulda —source http://gems.github.com

Use it in a Rails app by placing in config/environments/test.rb:

config.gem 'seanhussey-woulda', :lib => 'woulda', :source => 'http://gems.github.com'

Woulda requires shoulda >= 2.0.0.

Included Macros

# acts_as_ferret
class PostTest < Test::Unit::TestCase
  should_act_as_ferret :title, :contents
end

# acts_as_list
class NewsItemTest < Test::Unit::TestCase
  should_act_as_list
end

# acts_as_paranoid
class DocumentTest < Test::Unit::TestCase
  should_act_as_paranoid
end

# acts_as_taggable_on_steroids
class PersonTest < Test::Unit::TestCase
  should_act_as_taggable_on_steroids
end

# attachment_fu
class ImageTest < Test::Unit::TestCase
  should_have_attachment :content_type => :image
end

# enumeration_mixin
class RoleTest < Test::Unit::TestCase
  should_act_as_enumerated
end

# lazy_http
class PageControllerTest < ActionController::TestCase
  lazy_get :index, :about_us, :contact
end

# paperclip
class UserTest < Test::Unit::TestCase
  should_have_attached_file :avatar
end

# will_paginate
class PostTest < Test::Unit::TestCase
  should_have_per_page 10
end

# acts_as_solr
class ProductTest < Test::Unit::TestCase
  should_act_as_solr :name, :price
end

# acts_as_xapian
class ProductTest < Test::Unit::TestCase
  should_act_as_xapian :name, :description
end 

# acts_as_state_machine
class OrderTest < Test::Unit::TestCase
  should_act_as_state_machine :initial => :open, :states => [:closed], :events => {:close_order => {:to => :closed, :from => :open}}
end

# acts_as_versioned
class ProductTest < Test::Unit::TestCase
  should_act_as_versioned
end

# workflow
class OrderTest < Test::Unit::TestCase
  should_have_workflow :initial => :open, :states => [:closed], :events => {:close_order => {:to => :closed, :from => :open}}
end

The source

The source is available from GitHub.

Clone it:

git clone git://github.com/seanhussey/woulda.git

Credit

Written by Sean Hussey and Josh Nichols

Copyright 2008 Sean Hussey and Josh Nichols.