Sha256: 48f495b13ec12944be0322543c73b3bc4821b5dc45820b9289d7160b7e29593a

Contents?: true

Size: 831 Bytes

Versions: 2

Compression:

Stored size: 831 Bytes

Contents

require "test/unit"
require File.dirname(__FILE__) + "../../../lib/roger/rack/roger"

module Roger
  # Test Roger Server test
  class ServerTest < ::Test::Unit::TestCase
    def setup
      @project = Project.new(File.dirname(__FILE__) + "/../../project", mockupfile_path: false)
      @server = Server.new(@project)
    end

    # Test to see if env["roger.project"] is set
    def test_env_roger_project_is_set
      test = Class.new do
        def initialize(_app)
        end

        def call(env)
          [200, {}, [env["roger.project"].object_id.to_s]]
        end
      end

      @server.use test

      request = ::Rack::MockRequest.new(@server.send(:application))

      # This is a bit of a clunky comparison but it suffices for now
      assert_equal @project.object_id.to_s, request.get("/").body
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
roger-1.2.2 test/unit/server_test.rb
roger-1.2.1 test/unit/server_test.rb