Sha256: 5e2fbc130445a6660678a9c98e7e272ef9240dd3b88dfda697af59a3df15de05

Contents?: true

Size: 1.69 KB

Versions: 7

Compression:

Stored size: 1.69 KB

Contents

require 'rack/test'
require File.join(File.dirname(__FILE__), "spec_helper")

base = ::Middleman::Base
base.set :root, File.join(File.dirname(__FILE__), "fixtures", "sample")

describe "page_classes helper" do
  it "should generate root paths correctly" do
    browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
    browser.get("/page-class.html")
    browser.last_response.body.chomp.should == "page-class"
  end
  
  it "should generate 1-deep paths correctly" do
    browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
    browser.get("/sub1/page-class.html")
    browser.last_response.body.chomp.should == "sub1 sub1_page-class"
  end

  it "should generate 2-deep paths correctly" do
    browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
    browser.get("/sub1/sub2/page-class.html")
    browser.last_response.body.chomp.should == "sub1 sub1_sub2 sub1_sub2_page-class"
  end
end

describe "auto_stylesheet_link_tag helper" do
  it "should generate root paths correctly" do
    browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
    browser.get("/auto-css.html")
    browser.last_response.body.chomp.should include("stylesheets/auto-css.css")
  end
  
  it "should generate 1-deep paths correctly" do
    browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
    browser.get("/sub1/auto-css.html")
    browser.last_response.body.chomp.should include("stylesheets/sub1/auto-css.css")
  end

  it "should generate 2-deep paths correctly" do
    browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
    browser.get("/sub1/sub2/auto-css.html")
    browser.last_response.body.chomp.should include("stylesheets/sub1/sub2/auto-css.css")
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
middleman-0.10.13 spec/helpers_spec.rb
middleman-0.10.12 spec/helpers_spec.rb
middleman-0.10.11 spec/helpers_spec.rb
middleman-0.10.10 spec/helpers_spec.rb
middleman-0.10.9 spec/helpers_spec.rb
middleman-0.10.8 spec/helpers_spec.rb
middleman-0.10.7 spec/helpers_spec.rb