Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Markech
refinerycms-photo-gallery
Commits
ca71cb1f
Commit
ca71cb1f
authored
Dec 26, 2016
by
Martin Markech
Browse files
tests for photos
parent
20aec05d
Changes
6
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
ca71cb1f
...
...
@@ -253,9 +253,16 @@ Remove fancybox init javascript from _javascripts.html.erb file
Remove gem from Gemfile
## Testing
*
cd to this engine path
*
bundle install
*
rake refinery:testing:dummy_app
*
rake spec
*
Probably you will need to set some asset manifest to dummy's app manifest - see console output for errors
## Todo list
*
create app tests
*
show live links in admin
*
create pop-up window to upload photos from pages area, like page-images
*
add checkboxes to delete multiple/all photos in album
...
...
@@ -278,9 +285,9 @@ file extensions to upload queue. ( But server side validation reject these files
*
album/photo tags using acts_as_taggable ?
*
show photo location on google maps ?
## Testing
TODO
## License
...
...
app/controllers/refinery/photo_gallery/admin/photos_controller.rb
View file @
ca71cb1f
...
...
@@ -51,6 +51,9 @@ module Refinery
if
@photo
.
destroy
respond_to
do
|
format
|
format
.
html
{
redirect_to
refinery
.
photo_gallery_admin_albums_path
}
format
.
js
{
render
:partial
=>
"destroy"
,
:locals
=>
{
:photo
=>
@photo
}
}
...
...
app/models/refinery/photo_gallery/photo.rb
View file @
ca71cb1f
...
...
@@ -56,20 +56,6 @@ module Refinery
end
=begin
#TODO add checkbox to check if it should be writed to exif, globally on/off writing
def exif_write
# should only write if tags are changed as images can be large and thus ExifTool will take a while to write to the file
photo = MiniExiftool.new(self.file.file.file)
photo.GPSLongitude = self.longitude
photo.GPSLatitude = self.latitude
photo.DocumentName = self.title
photo.ImageDescription = self.description
photo.Keywords = self.tags
photo.save
end
=end
end
end
end
...
...
spec/factories/albums.rb
View file @
ca71cb1f
...
...
@@ -4,5 +4,20 @@ FactoryGirl.define do
path
"15_04"
description
"describtion about album"
address
"slovakia"
factory
:album_with_photos
do
transient
do
photos_count
5
end
# the after(:create) yields two values; the user instance itself and the
# evaluator, which stores all values from the factory, including transient
# attributes; `create_list`'s second argument is the number of records
# to create and we make sure the user is associated properly to the post
after
(
:create
)
do
|
album
,
evaluator
|
create_list
(
:photo
,
evaluator
.
photos_count
,
album:
album
)
end
end
end
end
\ No newline at end of file
spec/factories/photos.rb
View file @
ca71cb1f
FactoryGirl
.
define
do
factory
:photo
,
class:
Refinery
::
PhotoGallery
::
Photo
do
title
"Photo"
description
"description"
path
"16_04"
#sequence(:title){|n| "Photo-#{n}" }
#
file { Rack::Test::UploadedFile.new( File.open(File.join(File.join(Refinery.roots(:'refinery/photo_gallery'), 'spec', 'support', 'images', 'refinery-logo-trans.png'))), "image/png" ) }
file
{
Rack
::
Test
::
UploadedFile
.
new
(
File
.
open
(
File
.
join
(
File
.
join
(
Refinery
.
roots
(
:'refinery/photo_gallery'
),
'spec'
,
'support'
,
'images'
,
'refinery-logo-trans.png'
))),
"image/png"
)
}
end
end
...
...
spec/features/manage_photos_spec.rb
0 → 100644
View file @
ca71cb1f
require
"spec_helper"
describe
"manage photo items"
,
:type
=>
:feature
do
refinery_login_with_devise
:authentication_devise_refinery_superuser
describe
"edit/update"
do
before
do
FactoryGirl
.
create
(
:album_with_photos
,
:title
=>
"Album name"
)
end
it
"updates photo"
do
visit
refinery
.
photo_gallery_admin_albums_path
expect
(
page
).
to
have_content
(
"Album name"
)
click_link
"Edit photos in album"
fill_in
"photos_photo_5_title"
,
:with
=>
"Updated title 5"
fill_in
"photos_photo_4_title"
,
:with
=>
"Updated title 4"
fill_in
"photos_photo_3_title"
,
:with
=>
"Updated title 3"
fill_in
"photos_photo_2_title"
,
:with
=>
"Updated title 2"
fill_in
"photos_photo_1_title"
,
:with
=>
"Updated title 1"
click_button
"Save"
expect
(
page
).
to
have_content
(
"Updated photos"
)
end
end
describe
"destroy"
do
before
do
FactoryGirl
.
create
(
:album_with_photos
,
:title
=>
"Album name"
)
end
it
"removes photo"
do
visit
refinery
.
photo_gallery_admin_albums_path
expect
(
page
).
to
have_content
(
"Album name"
)
click_link
"Edit photos in album"
first
(
:link
,
"Remove"
).
click
expect
(
Refinery
::
PhotoGallery
::
Photo
.
count
).
to
eq
(
4
)
end
end
end
\ No newline at end of file
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