2015-02-22 23:44:17 +01:00
Feature : Assets get file hashes appended to them and references to them are updated
2014-09-28 22:39:46 +02:00
Scenario : Hashed-asset files are produced, and HTML, CSS, JSON and JavaScript gets rewritten to reference the new files
2012-03-05 00:24:38 +01: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-27 00:08:59 +02:00
| a p p l e - t o u c h - i c o n . p n g |
2012-06-02 08:54:57 +02:00
| f a v i c o n . i c o |
2012-03-05 00:24:38 +01: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 21:25:28 +01: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-05 00:24:38 +01: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 23:29:29 +02: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 |
2015-09-17 22:53:43 +02:00
| s t y l e s h e e t s / s i t e - 8 b c 5 5 9 8 5 . c s s |
2012-03-05 00:24:38 +01: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 22:39:46 +02:00
| a p i . j s o n |
| s u b d i r / a p i . j s o n |
2012-03-05 00:24:38 +01: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 23:09:47 +02:00
2012-05-24 23:29:29 +02: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 ' "
2015-09-17 22:53:43 +02:00
And t h e f i l e " s t y l e s h e e t s / s i t e - 8 b c 5 5 9 8 5 . c s s " s h o u l d c o n t a i n :
2014-04-07 21:43:16 +02:00
"""
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 " )
"""
2012-05-27 00:08:59 +02: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 ' h r e f = " a p p l e - t o u c h - i c o n . p n g " '
2015-09-17 22:53:43 +02: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 ' h r e f = " s t y l e s h e e t s / s i t e - 8 b c 5 5 9 8 5 . c s s " '
2012-05-24 23:29:29 +02: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 08:03:21 +01: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 " '
2015-09-17 22:53:43 +02: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 - 8 b c 5 5 9 8 5 . c s s " '
2014-11-16 21:25:28 +01: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-24 23:29:29 +02: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 08:03:21 +01: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 " '
2015-09-17 22:53:43 +02: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 - 8 b c 5 5 9 8 5 . c s s " '
2012-05-24 23:29:29 +02: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 08:03:21 +01: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 22:39:46 +02: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 23:09:47 +02:00
2015-05-28 16:21:50 +02:00
Scenario : Hashed fonts assets work with woff and woff2 extension
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 :
| f o n t s / f o n t a w e s o m e - w e b f o n t - 5 6 c e 1 3 e 7 . w o f f |
| f o n t s / f o n t a w e s o m e - w e b f o n t - 1 0 7 5 2 3 1 6 . w o f f 2 |
And t h e f i l e " s t y l e s h e e t s / u s e s _ f o n t s - 8 8 a a 3 e 2 b . c s s " s h o u l d c o n t a i n " s r c : u r l ( ' . . / f o n t s / f o n t a w e s o m e - w e b f o n t - 1 0 7 5 2 3 1 6 . w o f f 2 ' ) "
And t h e f i l e " s t y l e s h e e t s / u s e s _ f o n t s - 8 8 a a 3 e 2 b . c s s " s h o u l d c o n t a i n " u r l ( ' . . / f o n t s / f o n t a w e s o m e - w e b f o n t - 5 6 c e 1 3 e 7 . w o f f ' ) "
2012-03-05 00:24:38 +01: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-27 00:08:59 +02: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 " '
2014-04-07 21:43:16 +02:00
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 - 7 4 7 4 c a d d . c s s " '
2012-05-24 23:29:29 +02: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 08:03:21 +01: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 21:25:28 +01: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-05 00:24:38 +01:00
When I g o t o " / s u b d i r / "
2014-04-07 21:43:16 +02: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 - 7 4 7 4 c a d d . c s s " '
2012-05-24 23:29:29 +02: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 08:03:21 +01: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-05 00:24:38 +01:00
When I g o t o " / o t h e r / "
2014-04-07 21:43:16 +02: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 - 7 4 7 4 c a d d . c s s " '
2012-05-24 23:29:29 +02: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 08:03:21 +01: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 23:29:29 +02: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-05 00:24:38 +01: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 ' "
2014-04-07 21:43:16 +02:00
When I g o t o " / s t y l e s h e e t s / s i t e - 7 4 7 4 c a d d . c s s "
2014-11-19 18:04:56 +01: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 22:39:46 +02: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-05 00:24:38 +01:00
2015-04-26 18:31:39 +02: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 18:43:20 +02: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 18:31:39 +02: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 23:09:47 +02:00
Scenario : Enabling an asset host still produces hashed files and references
2012-04-02 03:05:20 +02: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 " / "
2014-04-07 21:43:16 +02: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 - 1 f d f 4 f b 5 . c s s " '
2012-04-02 03:05:20 +02: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 / "
2014-04-07 21:43:16 +02: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 - 1 f d f 4 f b 5 . c s s " '
2012-04-02 03:05:20 +02: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 / "
2014-04-07 21:43:16 +02: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 - 1 f d f 4 f b 5 . c s s " '
2012-04-02 03:05:20 +02: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 " '
2012-04-04 09:00:33 +02:00
2012-05-24 23:29:29 +02:00
Scenario : The asset hash should change when a SASS partial changes
2012-04-04 09:00:33 +02: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-27 00:08:59 +02: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 09:00:33 +02: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 21:30:47 +02: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 '
2014-04-16 00:16:52 +02:00
u s e : : M i d d l e w a r e
2012-09-06 21:30:47 +02: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 "
When I g o t o " / "
2014-04-07 21:43:16 +02: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 - a c 2 1 6 6 f d . c s s '
When I g o t o " s t y l e s h e e t s / s i t e - a c 2 1 6 6 f d . c s s "
2012-09-11 06:56:12 +02: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 '
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 '
2014-04-07 21:43:16 +02:00
When I g o t o " s t y l e s h e e t s / s i t e - 7 4 7 4 c a d d . c s s "
2012-09-11 06:56:12 +02:00
Then I s h o u l d s e e ' N o t F o u n d '
2012-12-18 11:19:41 +01: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 :
"""
2014-06-03 00:56:07 +02:00
i s _ s t y l e s h e e t = p r o c { | p a t h | p a t h . s t a r t _ w i t h ? ' s t y l e s h e e t s ' }
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 / * ' ,
i s _ s t y l e s h e e t
]
2012-12-18 11:19:41 +01:00
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 |
2014-06-03 00:56:07 +02:00
| s t y l e s h e e t s / s i t e . c s s |
2012-12-18 11:19:41 +01: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 22:39:46 +02:00
| a p i . j s o n |
| s u b d i r / a p i . j s o n |
2012-12-18 11:19:41 +01: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 |
2014-04-07 21:43:16 +02:00
| s t y l e s h e e t s / s i t e - 7 4 7 4 c a d d . c s s |
2013-09-26 23:09:47 +02:00
2013-10-15 23:33:25 +02: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 23:09:47 +02:00
2013-10-15 23:33:25 +02: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 23:09:47 +02:00
2013-10-15 23:33:25 +02: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"