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
df4fd988
Commit
df4fd988
authored
May 04, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor test to use fixture helper
parent
8fb03315
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
53 deletions
+39
-53
test/attachment_test.rb
+9
-13
test/geometry_test.rb
+3
-3
test/integration_test.rb
+12
-22
test/paperclip_test.rb
+2
-2
test/storage/s3_live_test.rb
+5
-5
test/storage/s3_test.rb
+5
-5
test/thumbnail_test.rb
+3
-3
No files found.
test/attachment_test.rb
View file @
df4fd988
...
@@ -7,7 +7,7 @@ class Dummy; end
...
@@ -7,7 +7,7 @@ class Dummy; end
class
AttachmentTest
<
Test
::
Unit
::
TestCase
class
AttachmentTest
<
Test
::
Unit
::
TestCase
should
"process :original style first"
do
should
"process :original style first"
do
file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"50x50.png"
),
'rb'
)
file
=
File
.
new
(
fixture_file
(
"50x50.png"
),
'rb'
)
rebuild_class
:styles
=>
{
:small
=>
'100x>'
,
:original
=>
'42x42#'
}
rebuild_class
:styles
=>
{
:small
=>
'100x>'
,
:original
=>
'42x42#'
}
dummy
=
Dummy
.
new
dummy
=
Dummy
.
new
dummy
.
avatar
=
file
dummy
.
avatar
=
file
...
@@ -20,7 +20,7 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -20,7 +20,7 @@ class AttachmentTest < Test::Unit::TestCase
end
end
should
"not delete styles that don't get reprocessed"
do
should
"not delete styles that don't get reprocessed"
do
file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"50x50.png"
),
'rb'
)
file
=
File
.
new
(
fixture_file
(
"50x50.png"
),
'rb'
)
rebuild_class
:styles
=>
{
:small
=>
'100x>'
,
rebuild_class
:styles
=>
{
:small
=>
'100x>'
,
:large
=>
'500x>'
,
:large
=>
'500x>'
,
:original
=>
'42x42#'
}
:original
=>
'42x42#'
}
...
@@ -202,9 +202,7 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -202,9 +202,7 @@ class AttachmentTest < Test::Unit::TestCase
rebuild_model
:path
=>
":id.omg/:id-bbq/:idwhat/:id_partition.wtf"
rebuild_model
:path
=>
":id.omg/:id-bbq/:idwhat/:id_partition.wtf"
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@dummy
.
stubs
(
:id
).
returns
(
1024
)
@dummy
.
stubs
(
:id
).
returns
(
1024
)
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
"fixtures"
,
"5k.png"
),
'rb'
)
@dummy
.
avatar
=
@file
@dummy
.
avatar
=
@file
end
end
...
@@ -418,9 +416,7 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -418,9 +416,7 @@ class AttachmentTest < Test::Unit::TestCase
setup
do
setup
do
rebuild_model
:path
=>
lambda
{
|
attachment
|
"path/
#{
attachment
.
instance
.
other
}
.:extension"
}
rebuild_model
:path
=>
lambda
{
|
attachment
|
"path/
#{
attachment
.
instance
.
other
}
.:extension"
}
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
"fixtures"
,
"5k.png"
),
'rb'
)
@dummyA
=
Dummy
.
new
(
:other
=>
'a'
)
@dummyA
=
Dummy
.
new
(
:other
=>
'a'
)
@dummyA
.
avatar
=
@file
@dummyA
.
avatar
=
@file
@dummyB
=
Dummy
.
new
(
:other
=>
'b'
)
@dummyB
=
Dummy
.
new
(
:other
=>
'b'
)
...
@@ -815,7 +811,7 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -815,7 +811,7 @@ class AttachmentTest < Test::Unit::TestCase
@instance
=
Dummy
.
new
@instance
=
Dummy
.
new
@instance
.
stubs
(
:id
).
returns
123
@instance
.
stubs
(
:id
).
returns
123
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"uppercase.PNG"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"uppercase.PNG"
),
'rb'
)
styles
=
{
:styles
=>
{
:large
=>
[
"400x400"
,
:jpg
],
styles
=
{
:styles
=>
{
:large
=>
[
"400x400"
,
:jpg
],
:medium
=>
[
"100x100"
,
:jpg
],
:medium
=>
[
"100x100"
,
:jpg
],
...
@@ -852,7 +848,7 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -852,7 +848,7 @@ class AttachmentTest < Test::Unit::TestCase
@instance
=
Dummy
.
new
@instance
=
Dummy
.
new
@instance
.
stubs
(
:id
).
returns
123
@instance
.
stubs
(
:id
).
returns
123
@attachment
=
Paperclip
::
Attachment
.
new
(
:avatar
,
@instance
)
@attachment
=
Paperclip
::
Attachment
.
new
(
:avatar
,
@instance
)
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
end
end
teardown
do
teardown
do
...
@@ -1046,7 +1042,7 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -1046,7 +1042,7 @@ class AttachmentTest < Test::Unit::TestCase
end
end
rebuild_class
rebuild_class
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
end
end
teardown
{
@file
.
close
}
teardown
{
@file
.
close
}
...
@@ -1167,7 +1163,7 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -1167,7 +1163,7 @@ class AttachmentTest < Test::Unit::TestCase
setup
do
setup
do
rebuild_model
:preserve_files
=>
true
rebuild_model
:preserve_files
=>
true
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
@dummy
.
avatar
=
@file
@dummy
.
avatar
=
@file
@dummy
.
save!
@dummy
.
save!
@attachment
=
@dummy
.
avatar
@attachment
=
@dummy
.
avatar
...
@@ -1191,7 +1187,7 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -1191,7 +1187,7 @@ class AttachmentTest < Test::Unit::TestCase
setup
do
setup
do
rebuild_model
rebuild_model
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
@dummy
.
avatar
=
@file
@dummy
.
avatar
=
@file
@dummy
.
save!
@dummy
.
save!
@attachment
=
@dummy
.
avatar
@attachment
=
@dummy
.
avatar
...
...
test/geometry_test.rb
View file @
df4fd988
...
@@ -101,7 +101,7 @@ class GeometryTest < Test::Unit::TestCase
...
@@ -101,7 +101,7 @@ class GeometryTest < Test::Unit::TestCase
end
end
should
"be generated from a file"
do
should
"be generated from a file"
do
file
=
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
)
file
=
fixture_file
(
"5k.png"
)
file
=
File
.
new
(
file
,
'rb'
)
file
=
File
.
new
(
file
,
'rb'
)
assert_nothing_raised
{
@geo
=
Paperclip
::
Geometry
.
from_file
(
file
)
}
assert_nothing_raised
{
@geo
=
Paperclip
::
Geometry
.
from_file
(
file
)
}
assert
@geo
.
height
>
0
assert
@geo
.
height
>
0
...
@@ -109,7 +109,7 @@ class GeometryTest < Test::Unit::TestCase
...
@@ -109,7 +109,7 @@ class GeometryTest < Test::Unit::TestCase
end
end
should
"be generated from a file path"
do
should
"be generated from a file path"
do
file
=
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
)
file
=
fixture_file
(
"5k.png"
)
assert_nothing_raised
{
@geo
=
Paperclip
::
Geometry
.
from_file
(
file
)
}
assert_nothing_raised
{
@geo
=
Paperclip
::
Geometry
.
from_file
(
file
)
}
assert
@geo
.
height
>
0
assert
@geo
.
height
>
0
assert
@geo
.
width
>
0
assert
@geo
.
width
>
0
...
@@ -141,7 +141,7 @@ class GeometryTest < Test::Unit::TestCase
...
@@ -141,7 +141,7 @@ class GeometryTest < Test::Unit::TestCase
begin
begin
ENV
[
'PATH'
]
=
''
ENV
[
'PATH'
]
=
''
assert_raises
(
Paperclip
::
Errors
::
CommandNotFoundError
)
do
assert_raises
(
Paperclip
::
Errors
::
CommandNotFoundError
)
do
file
=
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
)
file
=
fixture_file
(
"5k.png"
)
@geo
=
Paperclip
::
Geometry
.
from_file
(
file
)
@geo
=
Paperclip
::
Geometry
.
from_file
(
file
)
end
end
ensure
ensure
...
...
test/integration_test.rb
View file @
df4fd988
...
@@ -7,7 +7,7 @@ class IntegrationTest < Test::Unit::TestCase
...
@@ -7,7 +7,7 @@ class IntegrationTest < Test::Unit::TestCase
context
"Many models at once"
do
context
"Many models at once"
do
setup
do
setup
do
rebuild_model
rebuild_model
@file
=
File
.
new
(
File
.
join
(
FIXTURES_DIR
,
"5k.png"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
300
.
times
do
|
i
|
300
.
times
do
|
i
|
Dummy
.
create!
:avatar
=>
@file
Dummy
.
create!
:avatar
=>
@file
end
end
...
@@ -27,9 +27,7 @@ class IntegrationTest < Test::Unit::TestCase
...
@@ -27,9 +27,7 @@ class IntegrationTest < Test::Unit::TestCase
setup
do
setup
do
rebuild_model
:styles
=>
{
:thumb
=>
"50x50#"
}
rebuild_model
:styles
=>
{
:thumb
=>
"50x50#"
}
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
"fixtures"
,
"5k.png"
),
'rb'
)
@dummy
.
avatar
=
@file
@dummy
.
avatar
=
@file
assert
@dummy
.
save
assert
@dummy
.
save
end
end
...
@@ -88,9 +86,7 @@ class IntegrationTest < Test::Unit::TestCase
...
@@ -88,9 +86,7 @@ class IntegrationTest < Test::Unit::TestCase
File
.
delete
(
@thumb_path
)
if
File
.
exists?
(
@thumb_path
)
File
.
delete
(
@thumb_path
)
if
File
.
exists?
(
@thumb_path
)
rebuild_model
:styles
=>
{
:thumb
=>
"50x50#"
}
rebuild_model
:styles
=>
{
:thumb
=>
"50x50#"
}
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
"fixtures"
,
"5k.png"
),
'rb'
)
end
end
...
@@ -119,9 +115,7 @@ class IntegrationTest < Test::Unit::TestCase
...
@@ -119,9 +115,7 @@ class IntegrationTest < Test::Unit::TestCase
File
.
delete
(
@thumb_large_path
)
if
File
.
exists?
(
@thumb_large_path
)
File
.
delete
(
@thumb_large_path
)
if
File
.
exists?
(
@thumb_large_path
)
rebuild_model
:styles
=>
{
:thumb_small
=>
"50x50#"
,
:thumb_large
=>
"60x60#"
}
rebuild_model
:styles
=>
{
:thumb_small
=>
"50x50#"
,
:thumb_large
=>
"60x60#"
}
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
"fixtures"
,
"5k.png"
),
'rb'
)
@dummy
.
avatar
.
post_processing
=
false
@dummy
.
avatar
.
post_processing
=
false
@dummy
.
avatar
=
@file
@dummy
.
avatar
=
@file
...
@@ -158,9 +152,7 @@ class IntegrationTest < Test::Unit::TestCase
...
@@ -158,9 +152,7 @@ class IntegrationTest < Test::Unit::TestCase
setup
do
setup
do
rebuild_model
:styles
=>
{
:original
=>
"2x2#"
}
rebuild_model
:styles
=>
{
:original
=>
"2x2#"
}
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
"fixtures"
,
"5k.png"
),
'rb'
)
@dummy
.
avatar
=
@file
@dummy
.
avatar
=
@file
end
end
...
@@ -177,9 +169,7 @@ class IntegrationTest < Test::Unit::TestCase
...
@@ -177,9 +169,7 @@ class IntegrationTest < Test::Unit::TestCase
:medium
=>
"50x50"
},
:medium
=>
"50x50"
},
:path
=>
":rails_root/tmp/:id/:attachments/:style.:extension"
:path
=>
":rails_root/tmp/:id/:attachments/:style.:extension"
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
"fixtures"
,
"5k.png"
),
'rb'
)
@dummy
.
avatar
=
@file
@dummy
.
avatar
=
@file
end
end
...
@@ -286,7 +276,7 @@ class IntegrationTest < Test::Unit::TestCase
...
@@ -286,7 +276,7 @@ class IntegrationTest < Test::Unit::TestCase
setup
do
setup
do
rebuild_model
rebuild_model
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@file
=
File
.
new
(
File
.
join
(
FIXTURES_DIR
,
"5k.png"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
@umask
=
File
.
umask
(
umask
)
@umask
=
File
.
umask
(
umask
)
end
end
...
@@ -312,8 +302,8 @@ class IntegrationTest < Test::Unit::TestCase
...
@@ -312,8 +302,8 @@ class IntegrationTest < Test::Unit::TestCase
:url
=>
"/:attachment/:class/:style/:id/:basename.:extension"
,
:url
=>
"/:attachment/:class/:style/:id/:basename.:extension"
,
:path
=>
":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension"
:path
=>
":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension"
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@file
=
File
.
new
(
File
.
join
(
FIXTURES_DIR
,
"5k.png"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
@bad_file
=
File
.
new
(
File
.
join
(
FIXTURES_DIR
,
"bad.png"
),
'rb'
)
@bad_file
=
File
.
new
(
fixture_file
(
"bad.png"
),
'rb'
)
assert
@dummy
.
avatar
=
@file
assert
@dummy
.
avatar
=
@file
assert
@dummy
.
valid?
,
@dummy
.
errors
.
full_messages
.
join
(
", "
)
assert
@dummy
.
valid?
,
@dummy
.
errors
.
full_messages
.
join
(
", "
)
...
@@ -410,7 +400,7 @@ class IntegrationTest < Test::Unit::TestCase
...
@@ -410,7 +400,7 @@ class IntegrationTest < Test::Unit::TestCase
context
"that is assigned its file from another Paperclip attachment"
do
context
"that is assigned its file from another Paperclip attachment"
do
setup
do
setup
do
@dummy2
=
Dummy
.
new
@dummy2
=
Dummy
.
new
@file2
=
File
.
new
(
File
.
join
(
FIXTURES_DIR
,
"12k.png"
),
'rb'
)
@file2
=
File
.
new
(
fixture_file
(
"12k.png"
),
'rb'
)
assert
@dummy2
.
avatar
=
@file2
assert
@dummy2
.
avatar
=
@file2
@dummy2
.
save
@dummy2
.
save
end
end
...
@@ -437,7 +427,7 @@ class IntegrationTest < Test::Unit::TestCase
...
@@ -437,7 +427,7 @@ class IntegrationTest < Test::Unit::TestCase
has_many
:attachments
,
:class_name
=>
'Dummy'
has_many
:attachments
,
:class_name
=>
'Dummy'
end
end
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
@file
@dummy
.
avatar
=
@file
end
end
...
@@ -458,7 +448,7 @@ class IntegrationTest < Test::Unit::TestCase
...
@@ -458,7 +448,7 @@ class IntegrationTest < Test::Unit::TestCase
rebuild_model
@settings
rebuild_model
@settings
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
@dummy
=
Dummy
.
create!
:avatar
=>
@file
@dummy
=
Dummy
.
create!
:avatar
=>
@file
end
end
...
...
test/paperclip_test.rb
View file @
df4fd988
...
@@ -60,7 +60,7 @@ class PaperclipTest < Test::Unit::TestCase
...
@@ -60,7 +60,7 @@ class PaperclipTest < Test::Unit::TestCase
context
"Paperclip.each_instance_with_attachment"
do
context
"Paperclip.each_instance_with_attachment"
do
setup
do
setup
do
@file
=
File
.
new
(
File
.
join
(
FIXTURES_DIR
,
"5k.png"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
d1
=
Dummy
.
create
(
:avatar
=>
@file
)
d1
=
Dummy
.
create
(
:avatar
=>
@file
)
d2
=
Dummy
.
create
d2
=
Dummy
.
create
d3
=
Dummy
.
create
(
:avatar
=>
@file
)
d3
=
Dummy
.
create
(
:avatar
=>
@file
)
...
@@ -131,7 +131,7 @@ class PaperclipTest < Test::Unit::TestCase
...
@@ -131,7 +131,7 @@ class PaperclipTest < Test::Unit::TestCase
context
"An ActiveRecord model with an 'avatar' attachment"
do
context
"An ActiveRecord model with an 'avatar' attachment"
do
setup
do
setup
do
rebuild_model
:path
=>
"tmp/:class/omg/:style.:extension"
rebuild_model
:path
=>
"tmp/:class/omg/:style.:extension"
@file
=
File
.
new
(
File
.
join
(
FIXTURES_DIR
,
"5k.png"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
end
end
teardown
{
@file
.
close
}
teardown
{
@file
.
close
}
...
...
test/storage/s3_live_test.rb
View file @
df4fd988
...
@@ -5,7 +5,7 @@ unless ENV["S3_BUCKET"].blank?
...
@@ -5,7 +5,7 @@ unless ENV["S3_BUCKET"].blank?
class
S3LiveTest
<
Test
::
Unit
::
TestCase
class
S3LiveTest
<
Test
::
Unit
::
TestCase
context
"when assigning an S3 attachment directly to another model"
do
context
"when assigning an S3 attachment directly to another model"
do
setup
do
setup
do
@s3_credentials
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
".."
,
"fixtures"
,
"s3.yml"
))
@s3_credentials
=
File
.
new
(
fixture_file
(
"s3.yml"
))
rebuild_model
:styles
=>
{
:thumb
=>
"100x100"
,
:square
=>
"32x32#"
},
rebuild_model
:styles
=>
{
:thumb
=>
"100x100"
,
:square
=>
"32x32#"
},
:storage
=>
:s3
,
:storage
=>
:s3
,
:bucket
=>
ENV
[
"S3_BUCKET"
],
:bucket
=>
ENV
[
"S3_BUCKET"
],
...
@@ -40,7 +40,7 @@ unless ENV["S3_BUCKET"].blank?
...
@@ -40,7 +40,7 @@ unless ENV["S3_BUCKET"].blank?
context
"Generating an expiring url on a nonexistant attachment"
do
context
"Generating an expiring url on a nonexistant attachment"
do
setup
do
setup
do
@s3_credentials
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
".."
,
"fixtures"
,
"s3.yml"
))
@s3_credentials
=
File
.
new
(
fixture_file
(
"s3.yml"
))
rebuild_model
:styles
=>
{
:thumb
=>
"100x100"
,
:square
=>
"32x32#"
},
rebuild_model
:styles
=>
{
:thumb
=>
"100x100"
,
:square
=>
"32x32#"
},
:storage
=>
:s3
,
:storage
=>
:s3
,
:bucket
=>
ENV
[
"S3_BUCKET"
],
:bucket
=>
ENV
[
"S3_BUCKET"
],
...
@@ -57,7 +57,7 @@ unless ENV["S3_BUCKET"].blank?
...
@@ -57,7 +57,7 @@ unless ENV["S3_BUCKET"].blank?
context
"Using S3 for real, an attachment with S3 storage"
do
context
"Using S3 for real, an attachment with S3 storage"
do
setup
do
setup
do
@s3_credentials
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
".."
,
"fixtures"
,
"s3.yml"
))
@s3_credentials
=
File
.
new
(
fixture_file
(
"s3.yml"
))
rebuild_model
:styles
=>
{
:thumb
=>
"100x100"
,
:square
=>
"32x32#"
},
rebuild_model
:styles
=>
{
:thumb
=>
"100x100"
,
:square
=>
"32x32#"
},
:storage
=>
:s3
,
:storage
=>
:s3
,
:bucket
=>
ENV
[
"S3_BUCKET"
],
:bucket
=>
ENV
[
"S3_BUCKET"
],
...
@@ -99,7 +99,7 @@ unless ENV["S3_BUCKET"].blank?
...
@@ -99,7 +99,7 @@ unless ENV["S3_BUCKET"].blank?
context
"An attachment that uses S3 for storage and has spaces in file name"
do
context
"An attachment that uses S3 for storage and has spaces in file name"
do
setup
do
setup
do
@s3_credentials
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
".."
,
"fixtures"
,
"s3.yml"
))
@s3_credentials
=
File
.
new
(
fixture_file
(
"s3.yml"
))
rebuild_model
:styles
=>
{
:thumb
=>
"100x100"
,
:square
=>
"32x32#"
},
rebuild_model
:styles
=>
{
:thumb
=>
"100x100"
,
:square
=>
"32x32#"
},
:storage
=>
:s3
,
:storage
=>
:s3
,
:bucket
=>
ENV
[
"S3_BUCKET"
],
:bucket
=>
ENV
[
"S3_BUCKET"
],
...
@@ -139,7 +139,7 @@ unless ENV["S3_BUCKET"].blank?
...
@@ -139,7 +139,7 @@ unless ENV["S3_BUCKET"].blank?
context
"An attachment that uses S3 for storage and uses AES256 encryption"
do
context
"An attachment that uses S3 for storage and uses AES256 encryption"
do
setup
do
setup
do
@s3_credentials
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
".."
,
"fixtures"
,
"s3.yml"
))
@s3_credentials
=
File
.
new
(
fixture_file
(
"s3.yml"
))
rebuild_model
:styles
=>
{
:thumb
=>
"100x100"
,
:square
=>
"32x32#"
},
rebuild_model
:styles
=>
{
:thumb
=>
"100x100"
,
:square
=>
"32x32#"
},
:storage
=>
:s3
,
:storage
=>
:s3
,
:bucket
=>
ENV
[
"S3_BUCKET"
],
:bucket
=>
ENV
[
"S3_BUCKET"
],
...
...
test/storage/s3_test.rb
View file @
df4fd988
...
@@ -670,7 +670,7 @@ class S3Test < Test::Unit::TestCase
...
@@ -670,7 +670,7 @@ class S3Test < Test::Unit::TestCase
context
"when assigned"
do
context
"when assigned"
do
setup
do
setup
do
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'fixtures'
,
'5k.png'
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
'5k.png'
),
'rb'
)
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
@file
@dummy
.
avatar
=
@file
end
end
...
@@ -709,7 +709,7 @@ class S3Test < Test::Unit::TestCase
...
@@ -709,7 +709,7 @@ class S3Test < Test::Unit::TestCase
context
"when assigned"
do
context
"when assigned"
do
setup
do
setup
do
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'fixtures'
,
'5k.png'
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
'5k.png'
),
'rb'
)
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
@file
@dummy
.
avatar
=
@file
end
end
...
@@ -748,7 +748,7 @@ class S3Test < Test::Unit::TestCase
...
@@ -748,7 +748,7 @@ class S3Test < Test::Unit::TestCase
context
"when assigned"
do
context
"when assigned"
do
setup
do
setup
do
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'fixtures'
,
'5k.png'
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
'5k.png'
),
'rb'
)
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
@file
@dummy
.
avatar
=
@file
end
end
...
@@ -787,7 +787,7 @@ class S3Test < Test::Unit::TestCase
...
@@ -787,7 +787,7 @@ class S3Test < Test::Unit::TestCase
context
"when assigned"
do
context
"when assigned"
do
setup
do
setup
do
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'fixtures'
,
'5k.png'
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
'5k.png'
),
'rb'
)
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
@file
@dummy
.
avatar
=
@file
end
end
...
@@ -826,7 +826,7 @@ class S3Test < Test::Unit::TestCase
...
@@ -826,7 +826,7 @@ class S3Test < Test::Unit::TestCase
context
"when assigned"
do
context
"when assigned"
do
setup
do
setup
do
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'fixtures'
,
'5k.png'
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
'5k.png'
),
'rb'
)
@dummy
=
Dummy
.
new
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
@file
@dummy
.
avatar
=
@file
end
end
...
...
test/thumbnail_test.rb
View file @
df4fd988
...
@@ -36,7 +36,7 @@ class ThumbnailTest < Test::Unit::TestCase
...
@@ -36,7 +36,7 @@ class ThumbnailTest < Test::Unit::TestCase
context
"An image"
do
context
"An image"
do
setup
do
setup
do
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
end
end
teardown
{
@file
.
close
}
teardown
{
@file
.
close
}
...
@@ -296,7 +296,7 @@ class ThumbnailTest < Test::Unit::TestCase
...
@@ -296,7 +296,7 @@ class ThumbnailTest < Test::Unit::TestCase
context
"A multipage PDF"
do
context
"A multipage PDF"
do
setup
do
setup
do
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"twopage.pdf"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"twopage.pdf"
),
'rb'
)
end
end
teardown
{
@file
.
close
}
teardown
{
@file
.
close
}
...
@@ -329,7 +329,7 @@ class ThumbnailTest < Test::Unit::TestCase
...
@@ -329,7 +329,7 @@ class ThumbnailTest < Test::Unit::TestCase
context
"An animated gif"
do
context
"An animated gif"
do
setup
do
setup
do
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"animated.gif"
),
'rb'
)
@file
=
File
.
new
(
fixture_file
(
"animated.gif"
),
'rb'
)
end
end
teardown
{
@file
.
close
}
teardown
{
@file
.
close
}
...
...
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