diff --git a/Rakefile b/Rakefile index 229439bc..ebe09303 100755 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,6 @@ require 'lib/middleman' require 'rake' +require 'spec/rake/spectask' require 'cucumber/rake/task' begin @@ -13,23 +14,8 @@ begin gem.rubyforge_project = "middleman" gem.executables = %w(mm-init mm-build mm-server) gem.add_dependency("thin") - # gem.add_dependency("shotgun") - # gem.add_dependency("templater") - # gem.add_dependency("sprockets") - # gem.add_dependency("sinatra") - # gem.add_dependency("sinatra-content-for") - # gem.add_dependency("rack-test") - # gem.add_dependency("yui-compressor") - # gem.add_dependency("smusher") - # gem.add_dependency("haml", ">=2.1.0") - # gem.add_dependency("compass") - # gem.add_development_dependency("rdoc") - # gem.add_development_dependency("rspec") - # gem.add_development_dependency("sdoc") - # gem.add_development_dependency("cucumber") - - # Ignore vendored files - gem.files = gem.files.exclude("vendor/*") + gem.add_development_dependency("rspec") + gem.add_development_dependency("cucumber") end Jeweler::GemcutterTasks.new @@ -37,51 +23,15 @@ rescue LoadError puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler" end -require 'spec/rake/spectask' Spec::Rake::SpecTask.new(:spec) do |spec| spec.libs << 'lib' << 'spec' spec.spec_files = FileList['spec/**/*_spec.rb'] end -Spec::Rake::SpecTask.new(:rcov) do |spec| - spec.libs << 'lib' << 'spec' - spec.pattern = 'spec/**/*_spec.rb' - spec.rcov = true +Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t| + t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}" end task :spec => :check_dependencies -task :default => :spec - -require 'rake/rdoctask' -require 'sdoc' - -Rake::RDocTask.new do |rdoc| - if File.exist?('VERSION') - version = File.read('VERSION') - else - version = "" - end - - # rdoc.template = 'direct' - - rdoc.rdoc_dir = 'rdoc' - rdoc.title = "middleman #{version}" - rdoc.rdoc_files.include('README*') - rdoc.rdoc_files.include('lib/**/*.rb') - rdoc.rdoc_files.exclude('lib/middleman/features/sprockets+ruby19.rb') - rdoc.rdoc_files.exclude('lib/middleman/templater+dynamic_renderer.rb') -end - -desc "Build and publish documentation using GitHub Pages." -task :pages do - if !`git status`.include?('nothing to commit') - abort "dirty index - not publishing!" - end - - Rake::Task[:rerdoc].invoke - `git checkout gh-pages` - `ls -1 | grep -v rdoc | xargs rm -rf; mv rdoc/* .; rm -rf rdoc` - `git commit -a -m "update docs"; git push origin gh-pages` - `git checkout master` -end \ No newline at end of file +task :default => :spec \ No newline at end of file diff --git a/features/automatic_image_sizes.feature b/features/automatic_image_sizes.feature new file mode 100644 index 00000000..39ad67e7 --- /dev/null +++ b/features/automatic_image_sizes.feature @@ -0,0 +1,14 @@ +Feature: Automatically detect and insert image dimensions into tags + In order to speed up development and appease YSlow + + Scenario: Rendering an image with the feature enabled + Given "automatic_image_sizes" feature is "enabled" + When I go to "/auto-image-sizes.html" + Then I should see "width=" + And I should see "height=" + + Scenario: Rendering an image with the feature disabled + Given "automatic_image_sizes" feature is "disabled" + When I go to "/auto-image-sizes.html" + Then I should not see "width=" + And I should not see "height=" \ No newline at end of file diff --git a/features/cache_buster.feature b/features/cache_buster.feature new file mode 100644 index 00000000..da8e3055 --- /dev/null +++ b/features/cache_buster.feature @@ -0,0 +1,22 @@ +Feature: Generate mtime-based query string for busting browser caches + In order to display the most recent content for IE & CDNs and appease YSlow + + Scenario: Rendering css with the feature enabled + Given "cache_buster" feature is "enabled" + When I go to "/stylesheets/relative_assets.css" + Then I should see "?" + + Scenario: Rendering html with the feature enabled + Given "cache_buster" feature is "enabled" + When I go to "/cache-buster.html" + Then I should not see "?" + + Scenario: Rendering css with the feature disabled + Given "cache_buster" feature is "disabled" + When I go to "/stylesheets/relative_assets.css" + Then I should not see "?" + + Scenario: Rendering html with the feature disabled + Given "cache_buster" feature is "disabled" + When I go to "/cache-buster.html" + Then I should not see "?" \ No newline at end of file diff --git a/features/minify_css.feature b/features/minify_css.feature new file mode 100644 index 00000000..682d289e --- /dev/null +++ b/features/minify_css.feature @@ -0,0 +1,22 @@ +Feature: Minify CSS + In order reduce bytes sent to client and appease YSlow + + Scenario: Rendering inline css with the feature enabled + Given "minify_css" feature is "enabled" + When I go to "/inline-css.html" + Then I should see "1" lines + + Scenario: Rendering inline css with the feature disabled + Given "minify_css" feature is "disabled" + When I go to "/inline-css.html" + Then I should see "3" lines + + Scenario: Rendering external css with the feature enabled + Given "minify_css" feature is "enabled" + When I go to "/stylesheets/site.css" + Then I should see "1" lines + + Scenario: Rendering external css with the feature disabled + Given "minify_css" feature is "disabled" + When I go to "/stylesheets/site.css" + Then I should see "47" lines \ No newline at end of file diff --git a/features/minify_javascript.feature b/features/minify_javascript.feature new file mode 100644 index 00000000..9fe7d0ab --- /dev/null +++ b/features/minify_javascript.feature @@ -0,0 +1,12 @@ +Feature: Minify Javascript + In order reduce bytes sent to client and appease YSlow + + Scenario: Rendering inline js with the feature enabled + Given "minify_javascript" feature is "enabled" + When I go to "/inline-js.html" + Then I should see "1" lines + + Scenario: Rendering inline js with the feature disabled + Given "minify_javascript" feature is "disabled" + When I go to "/inline-js.html" + Then I should see "10" lines \ No newline at end of file diff --git a/features/page_alias_and_layouts.feature b/features/page_alias_and_layouts.feature new file mode 100644 index 00000000..c092b966 --- /dev/null +++ b/features/page_alias_and_layouts.feature @@ -0,0 +1,12 @@ +Feature: Custom layouts + In order easily switch between relative and absolute paths + + Scenario: Using custom :layout attribute + Given page "/custom-layout.html" has layout "custom" + When I go to "/custom-layout.html" + Then I should see "Custom Layout" + + Scenario: Using with_layout block + Given "/custom-layout.html" with_layout block has layout "custom" + When I go to "/custom-layout.html" + Then I should see "Custom Layout" \ No newline at end of file diff --git a/features/relative_assets.feature b/features/relative_assets.feature new file mode 100644 index 00000000..761c56b3 --- /dev/null +++ b/features/relative_assets.feature @@ -0,0 +1,12 @@ +Feature: Relative Assets + In order easily switch between relative and absolute paths + + Scenario: Rendering css with the feature disabled + Given "relative_assets" feature is "disabled" + When I go to "/stylesheets/relative_assets.css" + Then I should not see "../" + + Scenario: Rendering css with the feature enabled + Given "relative_assets" feature is "enabled" + When I go to "/stylesheets/relative_assets.css" + Then I should see "../" \ No newline at end of file diff --git a/features/step_definitions/env.rb b/features/step_definitions/env.rb new file mode 100644 index 00000000..c2318ff6 --- /dev/null +++ b/features/step_definitions/env.rb @@ -0,0 +1,2 @@ +require File.join(File.dirname(File.dirname(File.dirname(__FILE__))), 'lib', 'middleman') +require "rack/test" \ No newline at end of file diff --git a/features/step_definitions/middleman_steps.rb b/features/step_definitions/middleman_steps.rb new file mode 100644 index 00000000..43e01a79 --- /dev/null +++ b/features/step_definitions/middleman_steps.rb @@ -0,0 +1,22 @@ +Given /^"([^\"]*)" feature is "([^\"]*)"$/ do |feature, state| + enable_or_disable = (state == "enabled") ? :enable : :disable + Middleman::Base.set :root, File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "spec", "fixtures", "sample") + Middleman::Base.send(enable_or_disable, feature.to_sym) + @browser = Rack::Test::Session.new(Rack::MockSession.new(Middleman::Base.new)) +end + +When /^I go to "([^\"]*)"$/ do |url| + @browser.get(url) +end + +Then /^I should see "([^\"]*)"$/ do |expected| + @browser.last_response.body.should include(expected) +end + +Then /^I should not see "([^\"]*)"$/ do |expected| + @browser.last_response.body.should_not include(expected) +end + +Then /^I should see "([^\"]*)" lines$/ do |lines| + @browser.last_response.body.chomp.split($/).length.should == lines.to_i +end \ No newline at end of file diff --git a/features/step_definitions/page_layout_steps.rb b/features/step_definitions/page_layout_steps.rb new file mode 100644 index 00000000..c738ffc5 --- /dev/null +++ b/features/step_definitions/page_layout_steps.rb @@ -0,0 +1,13 @@ +Given /^page "([^\"]*)" has layout "([^\"]*)"$/ do |url, layout| + Middleman::Base.set :root, File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "spec", "fixtures", "sample") + Middleman::Base.page(url, :layout => layout.to_sym) + @browser = Rack::Test::Session.new(Rack::MockSession.new(Middleman::Base.new)) +end + +Given /^"([^\"]*)" with_layout block has layout "([^\"]*)"$/ do |url, layout| + Middleman::Base.set :root, File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "spec", "fixtures", "sample") + Middleman::Base.with_layout(:layout => layout.to_sym) do + page(url) + end + @browser = Rack::Test::Session.new(Rack::MockSession.new(Middleman::Base.new)) +end \ No newline at end of file diff --git a/lib/middleman/base.rb b/lib/middleman/base.rb index c0964e98..92c2629e 100755 --- a/lib/middleman/base.rb +++ b/lib/middleman/base.rb @@ -1,5 +1,6 @@ # We're riding on Sinatra, so let's include it -require 'sinatra/base' +require "sinatra/base" +require "sinatra/content_for" class Sinatra::Request attr_accessor :layout @@ -21,6 +22,7 @@ module Middleman set :http_prefix, nil use Rack::ConditionalGet if environment == :development + helpers Sinatra::ContentFor @@features = [] @@ -45,11 +47,11 @@ module Middleman ::Rack::Mime::MIME_TYPES[ext.to_s] = type end - # Convenience function to discover if a tempalte exists for the requested renderer (haml, sass, etc) + # Convenience function to discover if a template exists for the requested renderer (haml, sass, etc) def template_exists?(path, renderer=nil) template_path = path.dup template_path << ".#{renderer}" if renderer - File.exists? File.join(options.views, template_path) + File.readable? File.join(options.views, template_path) end # Base case renderer (do nothing), Should be over-ridden @@ -63,24 +65,6 @@ module Middleman end end include StaticRender - - def process_request - # Normalize the path and add index if we're looking at a directory - path = request.path - path << options.index_file if path.match(%r{/$}) - path.gsub!(%r{^/}, '') - - # layout(:"layout.html") # Insert the .html into the layout name like the rest of the templates - - # If the enabled renderers succeed, return the content, mime-type and an HTTP 200 - if content = render_path(path, (request.layout || :layout)) - content_type media_type(File.extname(path)), :charset => 'utf-8' - status 200 - content - else - status 404 - end - end def self.page(url, options={}, &block) get(url) do @@ -106,19 +90,34 @@ module Middleman not_found do process_request end + + private + def process_request + # Normalize the path and add index if we're looking at a directory + path = request.path + path << options.index_file if path.match(%r{/$}) + path.gsub!(%r{^/}, '') + + # If the enabled renderers succeed, return the content, mime-type and an HTTP 200 + if content = render_path(path, (request.layout || :layout)) + content_type media_type(File.extname(path)), :charset => 'utf-8' + status 200 + content + else + status 404 + end + end end end # Haml is required & includes helpers require "middleman/haml" require "middleman/sass" -require "sinatra/content_for" require "middleman/helpers" require "middleman/rack/static" require "middleman/rack/sprockets" class Middleman::Base - helpers Sinatra::ContentFor helpers Middleman::Helpers use Middleman::Rack::Static diff --git a/lib/middleman/features/automatic_image_sizes.rb b/lib/middleman/features/automatic_image_sizes.rb index 9352740a..777980a5 100755 --- a/lib/middleman/features/automatic_image_sizes.rb +++ b/lib/middleman/features/automatic_image_sizes.rb @@ -4,10 +4,14 @@ class Middleman::Base alias_method :pre_automatic_image_tag, :image_tag helpers do def image_tag(path, params={}) + if !options.respond_to?(:automatic_image_sizes?) || !options.automatic_image_sizes? + return pre_automatic_image_tag(path, params) + end + if (!params[:width] || !params[:height]) && !path.include?("://") params[:alt] ||= "" http_prefix = options.http_images_path rescue options.images_dir - + begin real_path = File.join(options.public, options.images_dir, path) if File.exists? real_path @@ -18,9 +22,7 @@ class Middleman::Base rescue end - params = params.merge(:src => asset_url(path, http_prefix)) - params = params.map { |k,v| %Q{#{k}="#{v}"}}.join(' ') - "" + capture_haml { haml_tag(:img, params.merge(:src => asset_url(path, http_prefix))) } else pre_automatic_image_tag(path, params) end diff --git a/lib/middleman/features/minify_css.rb b/lib/middleman/features/minify_css.rb index 9cb974c5..7b2300a5 100755 --- a/lib/middleman/features/minify_css.rb +++ b/lib/middleman/features/minify_css.rb @@ -1,9 +1,18 @@ -class Middleman::Base - after_feature_init do - ::Compass.configuration do |config| - config.output_style = :compressed - end +module Middleman + module Minified + module Sass + include ::Haml::Filters::Base - ::Compass.configure_sass_plugin! + def render(text) + result = ::Sass::Engine.new(text, ::Sass::Plugin.engine_options).render + + if Middleman::Base.respond_to?(:minify_css?) && Middleman::Base.minify_css? + compressor = YUI::CssCompressor.new + compressor.compress(result) + else + result + end + end + end end end \ No newline at end of file diff --git a/lib/middleman/features/minify_javascript.rb b/lib/middleman/features/minify_javascript.rb index 58093708..20f468d9 100755 --- a/lib/middleman/features/minify_javascript.rb +++ b/lib/middleman/features/minify_javascript.rb @@ -1,18 +1,22 @@ -require "middleman/builder" - module Middleman module Minified module Javascript include ::Haml::Filters::Base def render_with_options(text, options) - compressor = ::YUI::JavaScriptCompressor.new(:munge => true) - data = compressor.compress(text) - <#{data.chomp} + if Middleman::Base.respond_to?(:minify_javascript?) && Middleman::Base.minify_javascript? + compressor = ::YUI::JavaScriptCompressor.new(:munge => true) + data = compressor.compress(text) + %Q{} + else + < + // + END + end end end end -end - -Middleman::Base.supported_formats << "js" \ No newline at end of file +end \ No newline at end of file diff --git a/lib/middleman/features/relative_assets.rb b/lib/middleman/features/relative_assets.rb index 88e694b5..af5c4c6b 100755 --- a/lib/middleman/features/relative_assets.rb +++ b/lib/middleman/features/relative_assets.rb @@ -1,10 +1,22 @@ -::Compass.configuration do |config| - config.relative_assets = true +class Middleman::Base + after_feature_init do + ::Compass.configuration do |config| + config.relative_assets = Proc.new do + Middleman::Base.respond_to?(:relative_assets?) && Middleman::Base.relative_assets? + end + end + + ::Compass.configure_sass_plugin! + end end class << Middleman::Base alias_method :pre_relative_asset_url, :asset_url def asset_url(path, prefix="", request=nil) + if !self.respond_to?(:relative_assets?) || !self.relative_assets? + return pre_relative_asset_url(path, prefix, request) + end + begin prefix = self.images_dir if prefix == self.http_images_path rescue @@ -26,7 +38,6 @@ class << Middleman::Base (parts.length - 1).times { arry << ".." } arry << path File.join(*arry) - #"../" * (parts.length - 1) + path else path end diff --git a/lib/middleman/rack/sprockets.rb b/lib/middleman/rack/sprockets.rb index ce35fbf7..1192fc22 100755 --- a/lib/middleman/rack/sprockets.rb +++ b/lib/middleman/rack/sprockets.rb @@ -9,7 +9,7 @@ end begin require "yui/compressor" rescue LoadError - puts "Sprockets not available. Install it with: gem install yui-compressor" + puts "YUI-Compressor not available. Install it with: gem install yui-compressor" end module Middleman diff --git a/lib/middleman/sass.rb b/lib/middleman/sass.rb index ef46c90b..3c0f7af7 100755 --- a/lib/middleman/sass.rb +++ b/lib/middleman/sass.rb @@ -1,7 +1,12 @@ require "sass" -#gem "compass-edge" require "compass" +begin + require "yui/compressor" +rescue LoadError + puts "YUI-Compressor not available. Install it with: gem install yui-compressor" +end + module Middleman module Sass def self.included(base) @@ -17,7 +22,12 @@ module Middleman location_of_sass_file = options.environment == "build" ? File.join(Dir.pwd, options.build_dir) : options.public css_filename = File.join(location_of_sass_file, request.path_info) - sass(path.to_sym, ::Compass.sass_engine_options.merge({ :css_filename => css_filename })) + result = sass(path.to_sym, ::Compass.sass_engine_options.merge({ :css_filename => css_filename })) + if options.respond_to?(:minify_css?) && options.minify_css? + YUI::CssCompressor.new.compress(result) + else + result + end rescue Exception => e sass_exception_string(e) end diff --git a/spec/auto_image_sizes.rb b/spec/auto_image_sizes.rb deleted file mode 100755 index a691fbf2..00000000 --- a/spec/auto_image_sizes.rb +++ /dev/null @@ -1,22 +0,0 @@ -require File.join(File.dirname(__FILE__), "spec_helper") - -base = ::Middleman::Base -base.set :root, File.join(File.dirname(__FILE__), "fixtures", "sample") - -describe "Auto Image sizes Feature" do - it "should not append width and height if off" do - base.disable :automatic_image_sizes - browser = Rack::Test::Session.new(Rack::MockSession.new(base.new)) - browser.get("/auto-image-sizes.html") - browser.last_response.body.should_not include("width=") - browser.last_response.body.should_not include("height=") - end - - it "should append width and height if off" do - base.enable :automatic_image_sizes - browser = Rack::Test::Session.new(Rack::MockSession.new(base.new)) - browser.get("/auto-image-sizes.html") - browser.last_response.body.should include("width=") - browser.last_response.body.should include("height=") - end -end \ No newline at end of file diff --git a/spec/cache_buster_off_spec.rb b/spec/cache_buster_off_spec.rb deleted file mode 100755 index e9652bf0..00000000 --- a/spec/cache_buster_off_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require File.join(File.dirname(__FILE__), "spec_helper") - -describe "Cache Buster Feature in CSS" do - before do - base = ::Middleman::Base - base.set :root, File.join(File.dirname(__FILE__), "fixtures", "sample") - base.disable :cache_buster - @browser = Rack::Test::Session.new(Rack::MockSession.new(base.new)) - end - - it "should not append query string in CSS if off" do - @browser.get("/stylesheets/relative_assets.css") - @browser.last_response.body.count("?").should == 0 - end - - it "should not append query string in HTML if off" do - @browser.get("/cache-buster.html") - @browser.last_response.body.count("?").should == 0 - end -end \ No newline at end of file diff --git a/spec/cache_buster_on_spec.rb b/spec/cache_buster_on_spec.rb deleted file mode 100755 index f84479af..00000000 --- a/spec/cache_buster_on_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require File.join(File.dirname(__FILE__), "spec_helper") - -describe "Cache Buster Feature in CSS" do - before do - base = ::Middleman::Base - base.set :root, File.join(File.dirname(__FILE__), "fixtures", "sample") - base.enable :cache_buster - @browser = Rack::Test::Session.new(Rack::MockSession.new(base.new)) - end - - it "should append query string in CSS if on" do - @browser.get("/stylesheets/relative_assets.css") - @browser.last_response.body.should include("?") - end - - it "should not append query string in HTML if on IN DEVELOPMENT" do - @browser.get("/cache-buster.html") - @browser.last_response.body.count("?").should == 0 - end -end \ No newline at end of file diff --git a/spec/minify_css_spec.rb b/spec/minify_css_spec.rb deleted file mode 100755 index 3576da4c..00000000 --- a/spec/minify_css_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require File.join(File.dirname(__FILE__), "spec_helper") - -base = ::Middleman::Base -base.set :root, File.join(File.dirname(__FILE__), "fixtures", "sample") - -describe "Minify Javascript Feature" do - it "should not minify inline css if off" do - base.disable :minify_css - browser = Rack::Test::Session.new(Rack::MockSession.new(base.new)) - browser.get("/inline-css.html") - browser.last_response.body.chomp.split($/).length.should == 3 - end - - it "should minify inline css if on" do - base.enable :minify_css - browser = Rack::Test::Session.new(Rack::MockSession.new(base.new)) - browser.get("/inline-css.html") - browser.last_response.body.chomp.split($/).length.should == 1 - end -end \ No newline at end of file diff --git a/spec/minify_javascript_spec.rb b/spec/minify_javascript_spec.rb deleted file mode 100755 index 0081d354..00000000 --- a/spec/minify_javascript_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require File.join(File.dirname(__FILE__), "spec_helper") - -base = ::Middleman::Base -base.set :root, File.join(File.dirname(__FILE__), "fixtures", "sample") - -describe "Minify Javascript Feature" do - it "should not minify inline js if off" do - base.disable :minify_javascript - browser = Rack::Test::Session.new(Rack::MockSession.new(base.new)) - browser.get("/inline-js.html") - browser.last_response.body.chomp.split($/).length.should == 10 - end - - it "should minify inline js if on" do - base.enable :minify_javascript - browser = Rack::Test::Session.new(Rack::MockSession.new(base.new)) - browser.get("/inline-js.html") - browser.last_response.body.chomp.split($/).length.should == 1 - end -end \ No newline at end of file diff --git a/spec/page_alias_and_layouts_spec.rb b/spec/page_alias_and_layouts_spec.rb deleted file mode 100755 index b6269a04..00000000 --- a/spec/page_alias_and_layouts_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require File.join(File.dirname(__FILE__), "spec_helper") - -base = ::Middleman::Base -base.set :root, File.join(File.dirname(__FILE__), "fixtures", "sample") - -describe "Custom layout" do - it "should use custom layout" do - base.page "/custom-layout.html", :layout => :custom - browser = Rack::Test::Session.new(Rack::MockSession.new(base.new)) - browser.get("/custom-layout.html") - browser.last_response.body.should include("Custom Layout") - end - - it "should use custom layout with_layout method" do - base.with_layout :layout => :custom do - page "/custom-layout.html" - end - browser = Rack::Test::Session.new(Rack::MockSession.new(base.new)) - browser.get("/custom-layout.html") - browser.last_response.body.should include("Custom Layout") - end -end \ No newline at end of file diff --git a/spec/relative_assets_spec.rb b/spec/relative_assets_spec.rb deleted file mode 100755 index d982aedb..00000000 --- a/spec/relative_assets_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require File.join(File.dirname(__FILE__), "spec_helper") - -base = ::Middleman::Base -base.set :root, File.join(File.dirname(__FILE__), "fixtures", "sample") - -describe "Relative Assets Feature" do - it "should not contain ../ if off" do - base.disable :relative_assets - browser = Rack::Test::Session.new(Rack::MockSession.new(base.new)) - browser.get("/stylesheets/relative_assets.css") - browser.last_response.body.should_not include("../") - end - - it "should contain ../ if on" do - base.enable :relative_assets - browser = Rack::Test::Session.new(Rack::MockSession.new(base.new)) - browser.get("/stylesheets/relative_assets.css") - browser.last_response.body.should include("../") - end -end \ No newline at end of file