Sha256: 9e3137b8f2537c214f2bf014dd191caa997cf1825e604aff8a85f036c8b6048f

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'
require 'rack/test'

describe Rack::Usermanual do
  include Rack::Test::Methods

  def app
    Rack::Usermanual.new(nil, :layout => 'spec/fixtures/layout.haml', :sections => {'My section' => 'spec/fixtures/features/my-section'})
  end

  it "grabs a file from the features folder" do
    get '/help/my-section/test'
    last_response.should be_ok
    last_response.body.should include("This is the preamble")
  end

  it "accepts trailing slashes" do
    get '/help/my-section/test/'
    last_response.should be_ok
    last_response.body.should include("This is the preamble")
  end

  it "formats that file correctly" do
    get '/help/my-section/test'
    last_response.body.should include("Assume something is true")
  end

  it "does not allow you to get a random filesystem file" do
    get '/help/../../lib/solweb.rb'
    last_response.should_not be_ok
    get '/help/../docs/game-manual/combat.feature'
    last_response.should_not be_ok
  end

  it "returns 404 if the file doesn't exist" do
    get '/help/game-manual/cimbat'
    last_response.should_not be_ok
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rack-usermanual-0.4 spec/usermanual_spec.rb
rack-usermanual-0.3.2 spec/usermanual_spec.rb
rack-usermanual-0.3.1 spec/usermanual_spec.rb
rack-usermanual-0.3.0 spec/usermanual_spec.rb
rack-usermanual-0.2.0 spec/usermanual_spec.rb