Guest User

Untitled

a guest
Feb 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. module AttachmentFuMacros
  2. def should_have_attachment(options = {})
  3. klass = model_class
  4.  
  5. should_have_db_columns :size, :content_type, :filename
  6. if options[:content_type] == :image
  7. should_have_db_columns :height, :width
  8. end
  9.  
  10. should "define AttachmentFu class methods" do
  11. # breakpoint
  12. class_modules = (class << klass; included_modules; end)
  13. assert class_modules.include?(Technoweenie::AttachmentFu::ClassMethods),
  14. "#{klass} doesn't define AttachmentFu class methods"
  15. end
  16.  
  17. should "define AttachmentFu instance methods" do
  18. instance_modules = klass.included_modules
  19. assert instance_modules.include?(Technoweenie::AttachmentFu::InstanceMethods),
  20. "#{klass} doesn't define AttachmentFu instance methods"
  21. end
  22. end
  23. end
  24. Test::Unit::TestCase.extend(AttachmentFuMacros)
Add Comment
Please, Sign In to add comment