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
28a83058
Commit
28a83058
authored
Feb 13, 2009
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue with my own tests and the matchers.
parent
832298b6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
5 deletions
+5
-5
test/matchers/have_attached_file_matcher_test.rb
+1
-1
test/matchers/validate_attachment_content_type_matcher_test.rb
+1
-1
test/matchers/validate_attachment_presence_matcher_test.rb
+1
-1
test/matchers/validate_attachment_size_matcher_test.rb
+2
-2
No files found.
test/matchers/have_attached_file_matcher_test.rb
View file @
28a83058
...
@@ -5,7 +5,7 @@ class HaveAttachedFileMatcherTest < Test::Unit::TestCase
...
@@ -5,7 +5,7 @@ class HaveAttachedFileMatcherTest < Test::Unit::TestCase
setup
do
setup
do
@dummy_class
=
reset_class
"Dummy"
@dummy_class
=
reset_class
"Dummy"
reset_table
"dummies"
reset_table
"dummies"
@matcher
=
have_attached_file
(
:avatar
)
@matcher
=
self
.
class
.
have_attached_file
(
:avatar
)
end
end
should
"reject a class with no attachment"
do
should
"reject a class with no attachment"
do
...
...
test/matchers/validate_attachment_content_type_matcher_test.rb
View file @
28a83058
...
@@ -8,7 +8,7 @@ class ValidateAttachmentContentTypeMatcherTest < Test::Unit::TestCase
...
@@ -8,7 +8,7 @@ class ValidateAttachmentContentTypeMatcherTest < Test::Unit::TestCase
end
end
@dummy_class
=
reset_class
"Dummy"
@dummy_class
=
reset_class
"Dummy"
@dummy_class
.
has_attached_file
:avatar
@dummy_class
.
has_attached_file
:avatar
@matcher
=
validate_attachment_content_type
(
:avatar
).
@matcher
=
self
.
class
.
validate_attachment_content_type
(
:avatar
).
allowing
(
%w(image/png image/jpeg)
).
allowing
(
%w(image/png image/jpeg)
).
rejecting
(
%w(audio/mp3 application/octet-stream)
)
rejecting
(
%w(audio/mp3 application/octet-stream)
)
end
end
...
...
test/matchers/validate_attachment_presence_matcher_test.rb
View file @
28a83058
...
@@ -6,7 +6,7 @@ class ValidateAttachmentPresenceMatcherTest < Test::Unit::TestCase
...
@@ -6,7 +6,7 @@ class ValidateAttachmentPresenceMatcherTest < Test::Unit::TestCase
reset_table
(
"dummies"
){
|
d
|
d
.
string
:avatar_file_name
}
reset_table
(
"dummies"
){
|
d
|
d
.
string
:avatar_file_name
}
@dummy_class
=
reset_class
"Dummy"
@dummy_class
=
reset_class
"Dummy"
@dummy_class
.
has_attached_file
:avatar
@dummy_class
.
has_attached_file
:avatar
@matcher
=
validate_attachment_presence
(
:avatar
)
@matcher
=
self
.
class
.
validate_attachment_presence
(
:avatar
)
end
end
should
"reject a class with no validation"
do
should
"reject a class with no validation"
do
...
...
test/matchers/validate_attachment_size_matcher_test.rb
View file @
28a83058
...
@@ -11,7 +11,7 @@ class ValidateAttachmentSizeMatcherTest < Test::Unit::TestCase
...
@@ -11,7 +11,7 @@ class ValidateAttachmentSizeMatcherTest < Test::Unit::TestCase
end
end
context
"of limited size"
do
context
"of limited size"
do
setup
{
@matcher
=
validate_attachment_size
(
:avatar
).
in
(
256
..
1024
)
}
setup
{
@matcher
=
self
.
class
.
validate_attachment_size
(
:avatar
).
in
(
256
..
1024
)
}
should
"reject a class with no validation"
do
should
"reject a class with no validation"
do
assert_rejects
@matcher
,
@dummy_class
assert_rejects
@matcher
,
@dummy_class
...
@@ -34,7 +34,7 @@ class ValidateAttachmentSizeMatcherTest < Test::Unit::TestCase
...
@@ -34,7 +34,7 @@ class ValidateAttachmentSizeMatcherTest < Test::Unit::TestCase
end
end
context
"validates_attachment_size with infinite range"
do
context
"validates_attachment_size with infinite range"
do
setup
{
@matcher
=
validate_attachment_size
(
:avatar
)
}
setup
{
@matcher
=
self
.
class
.
validate_attachment_size
(
:avatar
)
}
should
"accept a class with an upper limit"
do
should
"accept a class with an upper limit"
do
@dummy_class
.
validates_attachment_size
:avatar
,
:less_than
=>
1
@dummy_class
.
validates_attachment_size
:avatar
,
:less_than
=>
1
...
...
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