PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/test/shoulda_macros/plugins.rb

https://github.com/newrooky/lftwb
Ruby | 30 lines | 21 code | 9 blank | 0 comment | 0 complexity | a910c98267a819e52b5f8c09e2de9ce6 MD5 | raw file
Possible License(s): MIT
  1. class Test::Unit::TestCase
  2. def self.should_act_as_taggable_on_steroids
  3. klass = self.name.gsub(/Test$/, '').constantize
  4. should "include ActsAsTaggableOnSteroids methods" do
  5. assert klass.extended_by.include?(ActiveRecord::Acts::Taggable::ClassMethods)
  6. assert klass.extended_by.include?(ActiveRecord::Acts::Taggable::SingletonMethods)
  7. assert klass.include?(ActiveRecord::Acts::Taggable::InstanceMethods)
  8. end
  9. should_have_many :taggings, :tags
  10. end
  11. def self.should_act_as_list
  12. klass = self.name.gsub(/Test$/, '').constantize
  13. context "To support acts_as_list" do
  14. should_have_db_column('position', :type => :integer)
  15. end
  16. should "include ActsAsList methods" do
  17. assert klass.include?(ActiveRecord::Acts::List::InstanceMethods)
  18. end
  19. should_have_instance_methods :acts_as_list_class, :position_column, :scope_condition
  20. end
  21. end