Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
e8d53313
Commit
e8d53313
authored
Dec 07, 2011
by
Abel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated documentation for Test::Unit
parent
3ba8fcba
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
2 deletions
+33
-2
lib/paperclip/matchers.rb
+33
-2
No files found.
lib/paperclip/matchers.rb
View file @
e8d53313
...
@@ -5,13 +5,15 @@ require 'paperclip/matchers/validate_attachment_size_matcher'
...
@@ -5,13 +5,15 @@ require 'paperclip/matchers/validate_attachment_size_matcher'
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
...
@@ -27,6 +29,35 @@ module Paperclip
...
@@ -27,6 +29,35 @@ module Paperclip
# 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment