2012-03-04 18:24:38 -05:00
Feature : Assets get a file hash appended to their and references to them are updated
2014-09-28 16:39:46 -04:00
Scenario : Hashed-asset files are produced, and HTML, CSS, JSON and JavaScript gets rewritten to reference the new files
2012-03-04 18:24:38 -05:00
Given a s u c c e s s f u l l y b u i l t a p p a t " a s s e t - h a s h - a p p "
When I c d t o " b u i l d "
Then t h e f o l l o w i n g f i l e s s h o u l d e x i s t :
| i n d e x . h t m l |
2012-05-26 18:08:59 -04:00
| a p p l e - t o u c h - i c o n . p n g |
2012-06-02 02:54:57 -04:00
| f a v i c o n . i c o |
2012-03-04 18:24:38 -05:00
| i m a g e s / 1 0 0 p x - 1 2 4 2 c 3 6 8 . p n g |
| i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g |
2014-11-16 15:25:28 -05:00
| i m a g e s / 2 0 0 p x - c 1 1 e b 2 0 3 . j p g |
| i m a g e s / 3 0 0 p x - 5 9 a d c e 7 6 . j p g |
2012-03-04 18:24:38 -05:00
| i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . g i f |
2012-05-24 17:29:29 -04:00
| j a v a s c r i p t s / a p p l i c a t i o n - 1 d 8 d 5 2 7 6 . j s |
2012-05-26 18:08:59 -04:00
| s t y l e s h e e t s / s i t e - 5 0 e a a 9 7 8 . c s s |
2012-03-04 18:24:38 -05:00
| i n d e x . h t m l |
| s u b d i r / i n d e x . h t m l |
| o t h e r / i n d e x . h t m l |
2014-09-28 16:39:46 -04:00
| a p i . j s o n |
| s u b d i r / a p i . j s o n |
2012-03-04 18:24:38 -05:00
And t h e f o l l o w i n g f i l e s s h o u l d n o t e x i s t :
| i m a g e s / 1 0 0 p x . p n g |
| i m a g e s / 1 0 0 p x . j p g |
| i m a g e s / 1 0 0 p x . g i f |
| j a v a s c r i p t s / a p p l i c a t i o n . j s |
| s t y l e s h e e t s / s i t e . c s s |
2013-09-26 17:09:47 -04:00
2012-05-24 17:29:29 -04:00
And t h e f i l e " j a v a s c r i p t s / a p p l i c a t i o n - 1 d 8 d 5 2 7 6 . j s " s h o u l d c o n t a i n " i m g . s r c = ' / i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g ' "
2012-05-26 18:08:59 -04:00
And t h e f i l e " s t y l e s h e e t s / s i t e - 5 0 e a a 9 7 8 . c s s " s h o u l d c o n t a i n " b a c k g r o u n d - i m a g e : u r l ( ' . . / i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g ' ) "
And t h e f i l e " i n d e x . h t m l " s h o u l d c o n t a i n ' h r e f = " a p p l e - t o u c h - i c o n . p n g " '
And t h e f i l e " i n d e x . h t m l " s h o u l d c o n t a i n ' h r e f = " s t y l e s h e e t s / s i t e - 5 0 e a a 9 7 8 . c s s " '
2012-05-24 17:29:29 -04:00
And t h e f i l e " i n d e x . h t m l " s h o u l d c o n t a i n ' s r c = " j a v a s c r i p t s / a p p l i c a t i o n - 1 d 8 d 5 2 7 6 . j s " '
2012-03-05 02:03:21 -05:00
And t h e f i l e " i n d e x . h t m l " s h o u l d c o n t a i n ' s r c = " i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g " '
2014-11-16 15:25:28 -05:00
And t h e f i l e " i n d e x . h t m l " s h o u l d c o n t a i n ' s r c s e t = " i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g 1 x , i m a g e s / 2 0 0 p x - c 1 1 e b 2 0 3 . j p g 2 x , i m a g e s / 3 0 0 p x - 5 9 a d c e 7 6 . j p g 3 x " '
And t h e f i l e " i n d e x . h t m l " s h o u l d c o n t a i n ' s r c = " i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . g i f " '
And t h e f i l e " i n d e x . h t m l " s h o u l d c o n t a i n ' s r c = " i m a g e s / 1 0 0 p x - 1 2 4 2 c 3 6 8 . p n g " '
2012-05-26 18:08:59 -04:00
And t h e f i l e " s u b d i r / i n d e x . h t m l " s h o u l d c o n t a i n ' h r e f = " . . / s t y l e s h e e t s / s i t e - 5 0 e a a 9 7 8 . c s s " '
2012-05-24 17:29:29 -04:00
And t h e f i l e " s u b d i r / i n d e x . h t m l " s h o u l d c o n t a i n ' s r c = " . . / j a v a s c r i p t s / a p p l i c a t i o n - 1 d 8 d 5 2 7 6 . j s " '
2012-03-05 02:03:21 -05:00
And t h e f i l e " s u b d i r / i n d e x . h t m l " s h o u l d c o n t a i n ' s r c = " . . / i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g " '
2012-05-26 18:08:59 -04:00
And t h e f i l e " o t h e r / i n d e x . h t m l " s h o u l d c o n t a i n ' h r e f = " . . / s t y l e s h e e t s / s i t e - 5 0 e a a 9 7 8 . c s s " '
2012-05-24 17:29:29 -04:00
And t h e f i l e " o t h e r / i n d e x . h t m l " s h o u l d c o n t a i n ' s r c = " . . / j a v a s c r i p t s / a p p l i c a t i o n - 1 d 8 d 5 2 7 6 . j s " '
2012-03-05 02:03:21 -05:00
And t h e f i l e " o t h e r / i n d e x . h t m l " s h o u l d c o n t a i n ' s r c = " . . / i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g " '
2014-09-28 16:39:46 -04:00
And t h e f i l e " a p i . j s o n " s h o u l d c o n t a i n ' i m a g e s / 100 p x - 5 f d 6 f b 90. g i f '
And t h e f i l e " a p i . j s o n " s h o u l d c o n t a i n ' i m a g e s / 100 p x - 5 f d 6 f b 90. j p g '
And t h e f i l e " a p i . j s o n " s h o u l d c o n t a i n ' i m a g e s / 100 p x - 1242 c 368. p n g '
And t h e f i l e " s u b d i r / a p i . j s o n " s h o u l d c o n t a i n ' i m a g e s / 100 p x - 5 f d 6 f b 90. g i f '
And t h e f i l e " s u b d i r / a p i . j s o n " s h o u l d c o n t a i n ' i m a g e s / 100 p x - 5 f d 6 f b 90. j p g '
And t h e f i l e " s u b d i r / a p i . j s o n " s h o u l d c o n t a i n ' i m a g e s / 100 p x - 1242 c 368. p n g '
2013-09-26 17:09:47 -04:00
2012-03-04 18:24:38 -05:00
Scenario : Hashed assets work in preview server
Given t h e S e r v e r i s r u n n i n g a t " a s s e t - h a s h - a p p "
When I g o t o " / "
2012-05-26 18:08:59 -04:00
Then I s h o u l d s e e ' h r e f = " a p p l e - t o u c h - i c o n . p n g " '
And I s h o u l d s e e ' h r e f = " s t y l e s h e e t s / s i t e - 5 0 e a a 9 7 8 . c s s " '
2012-05-24 17:29:29 -04:00
And I s h o u l d s e e ' s r c = " j a v a s c r i p t s / a p p l i c a t i o n - 1 d 8 d 5 2 7 6 . j s " '
2012-03-05 02:03:21 -05:00
And I s h o u l d s e e ' s r c = " i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g " '
2014-11-16 15:25:28 -05:00
And I s h o u l d s e e ' s r c s e t = " i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g 1 x , i m a g e s / 2 0 0 p x - c 1 1 e b 2 0 3 . j p g 2 x , i m a g e s / 3 0 0 p x - 5 9 a d c e 7 6 . j p g 3 x " '
2012-03-04 18:24:38 -05:00
When I g o t o " / s u b d i r / "
2012-05-26 18:08:59 -04:00
Then I s h o u l d s e e ' h r e f = " . . / s t y l e s h e e t s / s i t e - 5 0 e a a 9 7 8 . c s s " '
2012-05-24 17:29:29 -04:00
And I s h o u l d s e e ' s r c = " . . / j a v a s c r i p t s / a p p l i c a t i o n - 1 d 8 d 5 2 7 6 . j s " '
2012-03-05 02:03:21 -05:00
And I s h o u l d s e e ' s r c = " . . / i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g " '
2012-03-04 18:24:38 -05:00
When I g o t o " / o t h e r / "
2012-05-26 18:08:59 -04:00
Then I s h o u l d s e e ' h r e f = " . . / s t y l e s h e e t s / s i t e - 5 0 e a a 9 7 8 . c s s " '
2012-05-24 17:29:29 -04:00
And I s h o u l d s e e ' s r c = " . . / j a v a s c r i p t s / a p p l i c a t i o n - 1 d 8 d 5 2 7 6 . j s " '
2012-03-05 02:03:21 -05:00
And I s h o u l d s e e ' s r c = " . . / i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g " '
2012-05-24 17:29:29 -04:00
When I g o t o " / j a v a s c r i p t s / a p p l i c a t i o n - 1 d 8 d 5 2 7 6 . j s "
2012-03-04 18:24:38 -05:00
Then I s h o u l d s e e " i m g . s r c = ' / i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g ' "
2012-05-26 18:08:59 -04:00
When I g o t o " / s t y l e s h e e t s / s i t e - 5 0 e a a 9 7 8 . c s s "
2012-04-01 21:05:20 -04:00
Then I s h o u l d s e e " b a c k g r o u n d - i m a g e : u r l ( ' . . / i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g ' ) "
2014-09-28 16:39:46 -04:00
When I g o t o " / a p i . j s o n "
Then I s h o u l d s e e ' i m a g e s / 100 p x - 5 f d 6 f b 90. g i f '
And I s h o u l d s e e ' i m a g e s / 100 p x - 5 f d 6 f b 90. j p g '
And I s h o u l d s e e ' i m a g e s / 100 p x - 1242 c 368. p n g '
When I g o t o " / s u b d i r / a p i . j s o n "
Then I s h o u l d s e e ' i m a g e s / 100 p x - 5 f d 6 f b 90. g i f '
And I s h o u l d s e e ' i m a g e s / 100 p x - 5 f d 6 f b 90. j p g '
And I s h o u l d s e e ' i m a g e s / 100 p x - 1242 c 368. p n g '
2012-03-04 18:24:38 -05:00
2015-04-26 12:31:39 -04:00
Scenario : Hashed assets work with Slim
Given t h e S e r v e r i s r u n n i n g a t " a s s e t - h a s h - a p p "
When I g o t o " / s l i m . h t m l "
2015-04-26 12:43:20 -04:00
And I s h o u l d s e e ' s r c = " i m a g e s / 3 0 0 p x - 5 9 a d c e 7 6 . j p g " '
2015-04-26 12:31:39 -04:00
And I s h o u l d s e e ' s r c = " i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g " '
And I s h o u l d s e e ' s r c s e t = " i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g 1 x , i m a g e s / 2 0 0 p x - c 1 1 e b 2 0 3 . j p g 2 x , i m a g e s / 3 0 0 p x - 5 9 a d c e 7 6 . j p g 3 x " '
2013-09-26 17:09:47 -04:00
Scenario : Enabling an asset host still produces hashed files and references
2012-04-01 21:05:20 -04:00
Given t h e S e r v e r i s r u n n i n g a t " a s s e t - h a s h - h o s t - a p p "
When I g o t o " / "
2013-04-20 18:14:41 -04:00
Then I s h o u l d s e e ' h r e f = " h t t p : / / m i d d l e m a n a p p . c o m / s t y l e s h e e t s / s i t e - 5 4 b a a f 3 a . c s s " '
2012-04-01 21:05:20 -04:00
And I s h o u l d s e e ' s r c = " h t t p : / / m i d d l e m a n a p p . c o m / i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g " '
When I g o t o " / s u b d i r / "
2013-04-20 18:14:41 -04:00
Then I s h o u l d s e e ' h r e f = " h t t p : / / m i d d l e m a n a p p . c o m / s t y l e s h e e t s / s i t e - 5 4 b a a f 3 a . c s s " '
2012-04-01 21:05:20 -04:00
And I s h o u l d s e e ' s r c = " h t t p : / / m i d d l e m a n a p p . c o m / i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g " '
When I g o t o " / o t h e r / "
2013-04-20 18:14:41 -04:00
Then I s h o u l d s e e ' h r e f = " h t t p : / / m i d d l e m a n a p p . c o m / s t y l e s h e e t s / s i t e - 5 4 b a a f 3 a . c s s " '
2012-04-01 21:05:20 -04:00
And I s h o u l d s e e ' s r c = " h t t p : / / m i d d l e m a n a p p . c o m / i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g " '
# Asset helpers don't appear to work from Compass right now
2012-04-27 21:15:42 -04:00
# When I go to "/stylesheets/site-e5a31a3e.css"
2012-04-04 03:00:33 -04:00
# Then I should see "background-image: url('http://middlemanapp.com/images/100px-5fd6fb90.jpg')"
2012-05-24 17:29:29 -04:00
Scenario : The asset hash should change when a SASS partial changes
2012-04-04 03:00:33 -04:00
Given t h e S e r v e r i s r u n n i n g a t " a s s e t - h a s h - a p p "
And t h e f i l e " s o u r c e / s t y l e s h e e t s / _ p a r t i a l . s a s s " h a s t h e c o n t e n t s
"""
b o d y
f o n t - s i z e : 14 p x
"""
When I g o t o " / p a r t i a l s / "
2012-05-26 18:08:59 -04:00
Then I s h o u l d s e e ' h r e f = " . . / s t y l e s h e e t s / u s e s _ p a r t i a l s - 4 2 3 a 0 0 f 7 . c s s '
2012-04-04 03:00:33 -04:00
And t h e f i l e " s o u r c e / s t y l e s h e e t s / _ p a r t i a l . s a s s " h a s t h e c o n t e n t s
"""
b o d y
f o n t - s i z e : 18 p x ! i m p o r t a n t
"""
When I g o t o " / p a r t i a l s / "
2012-09-06 15:30:47 -04:00
Then I s h o u l d s e e ' h r e f = " . . / s t y l e s h e e t s / u s e s _ p a r t i a l s - e 8 c 3 d 4 e b . c s s '
Scenario : The asset hash should change when a Rack-based filter changes
Given a f i x t u r e a p p " a s s e t - h a s h - a p p "
And a f i l e n a m e d " c o n f i g . r b " w i t h :
"""
a c t i v a t e : a s s e t _ h a s h
a c t i v a t e : r e l a t i v e _ a s s e t s
a c t i v a t e : d i r e c t o r y _ i n d e x e s
r e q u i r e ' l i b / m i d d l e w a r e . r b '
u s e M i d d l e w a r e
"""
Given t h e S e r v e r i s r u n n i n g a t " a s s e t - h a s h - a p p "
When I g o t o " / "
Then I s h o u l d s e e ' h r e f = " s t y l e s h e e t s / s i t e - 5 7 7 0 a f 5 2 . c s s '
2012-09-11 00:56:12 -04:00
When I g o t o " s t y l e s h e e t s / s i t e - 5 7 7 0 a f 5 2 . c s s "
Then I s h o u l d s e e ' b a c k g r o u n d - i m a g e '
Then I s h o u l d s e e ' A d d e d b y R a c k f i l t e r '
When I g o t o " s t y l e s h e e t s / s i t e - 5 0 e a a 9 7 8 . c s s "
Then I s h o u l d s e e ' N o t F o u n d '
2012-12-18 05:19:41 -05:00
Scenario : Hashed-asset files are not produced for ignored paths
Given a f i x t u r e a p p " a s s e t - h a s h - a p p "
And a f i l e n a m e d " c o n f i g . r b " w i t h :
"""
a c t i v a t e : a s s e t _ h a s h , : i g n o r e = > [ % r ( j a v a s c r i p t s / * ) , ' i m a g e s / * ' ]
a c t i v a t e : r e l a t i v e _ a s s e t s
a c t i v a t e : d i r e c t o r y _ i n d e x e s
"""
And a s u c c e s s f u l l y b u i l t a p p a t " a s s e t - h a s h - a p p "
When I c d t o " b u i l d "
Then t h e f o l l o w i n g f i l e s s h o u l d e x i s t :
| i n d e x . h t m l |
| a p p l e - t o u c h - i c o n . p n g |
| f a v i c o n . i c o |
| i m a g e s / 1 0 0 p x . p n g |
| i m a g e s / 1 0 0 p x . j p g |
| i m a g e s / 1 0 0 p x . g i f |
| j a v a s c r i p t s / a p p l i c a t i o n . j s |
| s t y l e s h e e t s / s i t e - 5 0 e a a 9 7 8 . c s s |
| i n d e x . h t m l |
| s u b d i r / i n d e x . h t m l |
| o t h e r / i n d e x . h t m l |
2014-09-28 16:39:46 -04:00
| a p i . j s o n |
| s u b d i r / a p i . j s o n |
2012-12-18 05:19:41 -05:00
And t h e f o l l o w i n g f i l e s s h o u l d n o t e x i s t :
| i m a g e s / 1 0 0 p x - 1 2 4 2 c 3 6 8 . p n g |
| i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . j p g |
| i m a g e s / 1 0 0 p x - 5 f d 6 f b 9 0 . g i f |
| j a v a s c r i p t s / a p p l i c a t i o n - 1 d 8 d 5 2 7 6 . j s |
2013-09-26 17:09:47 -04:00
| s t y l e s h e e t s / s i t e . c s s |
2013-10-15 17:33:25 -04:00
# @wip Currently broken, we should move all asset-host functionality out of Compass and into something more similar to asset_hash with Rack-based rewrites
# Scenario: Enabling an asset host and referencing assets in CSS with URL fragments are rewritten correctly
# Given a successfully built app at "asset-hash-host-app"
# When I cd to "build"
2013-09-26 17:09:47 -04:00
2013-10-15 17:33:25 -04:00
# Then the following files should exist:
# | images/100px-5fd6fb90.jpg |
# | stylesheets/fragment-c058ecb2.css |
# And the following files should not exist:
# | images/100px.jpg |
2013-09-26 17:09:47 -04:00
2013-10-15 17:33:25 -04:00
# And the file "stylesheets/fragment-c058ecb2.css" should contain "http://middlemanapp.com/images/100px-5fd6fb90.jpg#test"
# And the file "stylesheets/fragment-c058ecb2.css" should not contain "http://middlemanapp.com/images/100px.jpg#test"