Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Updated documentation for Test::Unit
Browse files Browse the repository at this point in the history
  • Loading branch information
abelmartin committed Dec 7, 2011
1 parent 3ba8fcb commit e8d5331
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions lib/paperclip/matchers.rb
Expand Up @@ -5,13 +5,15 @@


module Paperclip module Paperclip
module Shoulda module Shoulda
# Provides rspec-compatible matchers for testing Paperclip attachments. # Provides RSpec-compatible & Test::Unit-compatible matchers for testing Paperclip attachments.
#
# *RSpec*
# #
# In spec_helper.rb, you'll need to require the matchers: # In spec_helper.rb, you'll need to require the matchers:
# #
# require "paperclip/matchers" # require "paperclip/matchers"
# #
# And include the module: # And _include_ the module:
# #
# Spec::Runner.configure do |config| # Spec::Runner.configure do |config|
# config.include Paperclip::Shoulda::Matchers # config.include Paperclip::Shoulda::Matchers
Expand All @@ -27,6 +29,35 @@ module Shoulda
# it { should validate_attachment_size(:avatar). # it { should validate_attachment_size(:avatar).
# less_than(2.megabytes) } # less_than(2.megabytes) }
# end # end
#
#
# *Test*::*Unit*
#
# In test_helper.rb, you'll need to require the matchers as well:
#
# require "paperclip/matchers"
#
# And _extend_ the module:
#
# class ActiveSupport::TestCase
# extend Paperclip::Shoulda::Matchers
#
# #...other initializers...#
# end
#
# Example:
# require 'test_helper'
#
# class UserTest < ActiveSupport::TestCase
# should have_attached_file(:avatar)
# should validate_attachment_presence(:avatar)
# should validate_attachment_content_type(:avatar).
# allowing('image/png', 'image/gif').
# rejecting('text/plain', 'text/xml')
# should validate_attachment_size(:avatar).
# less_than(2.megabytes)
# end
#
module Matchers module Matchers
end end
end end
Expand Down

0 comments on commit e8d5331

Please sign in to comment.