Sha256: 03225026581b433e89b8a9fdfe16b0fcc750e2e968d33e8cc58171fb6b58ba7a

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

require 'hyperloop'

describe Hyperloop::Application do
  describe 'with a flat views directory' do
    before :each do
      @app     = Hyperloop::Application.new('spec/fixtures/simple/')
      @request = Rack::MockRequest.new(@app)
    end

    it 'responds successfully to a request for root' do
      response = @request.get('/')

      expect(response).to be_ok
      expect(response.body).to match(/<h1>Simple/)
    end

    it 'responds successfully to a request for a different page' do
      response = @request.get('/about')

      expect(response).to be_ok
      expect(response.body).to match(/<h1>About/)
    end

    it '404s on a request for a nonexistent page' do
      response = @request.get('/nonexistent')

      expect(response).to be_not_found
    end
  end

  describe 'with subdirectories' do
    before :each do
      @app     = Hyperloop::Application.new('spec/fixtures/subdirectories/')
      @request = Rack::MockRequest.new(@app)
    end

    it 'responds successfully to a request for the subdirectory root' do
      response = @request.get('/subdir1')

      expect(response).to be_ok
      expect(response.body).to match(/<h1>Subdirectory Index/)
    end

    it 'responds successfully to a request for a different page in the subdirectory' do
      response = @request.get('/subdir1/kanye')

      expect(response).to be_ok
      expect(response.body).to match(/<h1>Hurry up with my damn croissant/)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hyperloop-0.0.2 spec/application_spec.rb