Use config.rb file contents in minify test cases instead of fixtures

This commit is contained in:
Thomas Reynolds 2012-04-26 14:07:10 -07:00
parent 6987043a5f
commit 240f67410d
5 changed files with 102 additions and 34 deletions

View file

@ -1,7 +1,6 @@
Feature: Text Files Without Extensions Should Build and Preview
Scenario: Building Text Files without directory indexes
Given a fixture app "extensionless-text-files-app"
And a file named "config.rb" with:
"""
@ -14,7 +13,6 @@ Feature: Text Files Without Extensions Should Build and Preview
| README |
Scenario: Building Text Files with directory indexes
Given a fixture app "extensionless-text-files-app"
And a file named "config.rb" with:
"""

View file

@ -1,8 +1,5 @@
Feature: Minify CSS
In order reduce bytes sent to client and appease YSlow
Background:
Given current environment is "build"
Scenario: Rendering external css with the feature disabled
Given a fixture app "minify-css-app"
@ -28,7 +25,20 @@ Feature: Minify CSS
Then I should see "1" lines
Scenario: Rendering external css with passthrough compressor
Given the Server is running at "passthrough-app"
Given a fixture app "passthrough-app"
And a file named "config.rb" with:
"""
module ::PassThrough
def self.compress(data)
data
end
end
activate :minify_css
set :css_compressor, ::PassThrough
"""
And the Server is running at "passthrough-app"
When I go to "/stylesheets/site.css"
Then I should see "55" lines
@ -52,7 +62,22 @@ Feature: Minify CSS
"""
Scenario: Rendering inline css with a passthrough minifier
Given the Server is running at "passthrough-app"
Given a fixture app "passthrough-app"
And a file named "config.rb" with:
"""
module ::PassThrough
def self.compress(data)
data
end
end
activate :minify_css, :inline => true
set :css_compressor, ::PassThrough
page "/inline-css.html", :layout => false
"""
And the Server is running at "passthrough-app"
When I go to "/inline-css.html"
Then I should see:
"""

View file

@ -1,11 +1,11 @@
Feature: Minify Javascript
In order reduce bytes sent to client and appease YSlow
Background:
Given current environment is "build"
Scenario: Rendering inline js with the feature disabled
Given "minify_javascript" feature is "disabled"
Given a fixture app "minify-js-app"
And a file named "config.rb" with:
"""
"""
And the Server is running at "minify-js-app"
When I go to "/inline-js.html"
Then I should see:
@ -42,7 +42,22 @@ Feature: Minify Javascript
"""
Scenario: Rendering inline js with a passthrough minifier
Given the Server is running at "passthrough-app"
Given a fixture app "passthrough-app"
And a file named "config.rb" with:
"""
module ::PassThrough
def self.compress(data)
data
end
end
activate :minify_javascript, :inline => true
set :js_compressor, ::PassThrough
page "/inline-js.html", :layout => false
"""
And the Server is running at "passthrough-app"
When I go to "/inline-js.html"
Then I should see:
"""
@ -78,7 +93,11 @@ Feature: Minify Javascript
"""
Scenario: Rendering inline js with the feature enabled
Given "minify_javascript" feature is "enabled" with ":inline => true"
Given a fixture app "minify-js-app"
And a file named "config.rb" with:
"""
activate :minify_javascript, :inline => true
"""
And the Server is running at "minify-js-app"
When I go to "/inline-js.html"
Then I should see:
@ -102,7 +121,11 @@ Feature: Minify Javascript
"""
Scenario: Rendering external js with the feature enabled
Given "minify_javascript" feature is "enabled"
Given a fixture app "minify-js-app"
And a file named "config.rb" with:
"""
activate :minify_javascript
"""
And the Server is running at "minify-js-app"
When I go to "/javascripts/js_test.js"
Then I should see "1" lines
@ -115,23 +138,62 @@ Feature: Minify Javascript
Then I should see "8" lines
Scenario: Rendering inline js (coffeescript) with the feature enabled
Given "minify_javascript" feature is "enabled" with ":inline => true"
Given a fixture app "minify-js-app"
And a file named "config.rb" with:
"""
require "coffee-filter"
activate :minify_javascript, :inline => true
"""
And the Server is running at "minify-js-app"
When I go to "/inline-coffeescript.html"
Then I should see "6" lines
Scenario: Rendering external js (coffeescript) with the feature enabled
Given "minify_javascript" feature is "enabled"
Given a fixture app "minify-js-app"
And a file named "config.rb" with:
"""
activate :minify_javascript
"""
And the Server is running at "minify-js-app"
When I go to "/javascripts/coffee_test.js"
Then I should see "1" lines
Scenario: Rendering inline js (coffeescript) with a passthrough minifier
Given the Server is running at "passthrough-app"
Given a fixture app "passthrough-app"
And a file named "config.rb" with:
"""
require "coffee-filter"
module ::PassThrough
def self.compress(data)
data
end
end
activate :minify_javascript, :inline => true
set :js_compressor, ::PassThrough
page "/inline-coffeescript.html", :layout => false
"""
And the Server is running at "passthrough-app"
When I go to "/inline-coffeescript.html"
Then I should see "16" lines
Scenario: Rendering external js (coffeescript) with a passthrough minifier
Given a fixture app "passthrough-app"
And a file named "config.rb" with:
"""
module ::PassThrough
def self.compress(data)
data
end
end
activate :minify_javascript
set :js_compressor, ::PassThrough
"""
And the Server is running at "passthrough-app"
When I go to "/javascripts/coffee_test.js"
Then I should see "11" lines

View file

@ -1,17 +0,0 @@
module ::PassThrough
def self.compress(data)
data
end
end
activate :minify_javascript
activate :minify_css
set :js_compressor, ::PassThrough
set :css_compressor, ::PassThrough
with_layout false do
page "/inline-css.html"
page "/inline-js.html"
page "/inline-coffeescript.html"
end