File: spec_helper.rb

package info (click to toggle)
yard 0.9.38-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,736 kB
  • sloc: ruby: 31,680; javascript: 7,658; makefile: 21
file content (21 lines) | stat: -rw-r--r-- 632 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

include Server
include Commands

def mock_adapter(opts = {})
  opts[:libraries] ||= {'project' => [LibraryVersion.new('project', '1.0.0'), LibraryVersion.new('project', '1.0.1')]}
  opts[:document_root] ||= '/public'
  opts[:options] ||= {:single_library => false, :caching => false}
  opts[:server_options] ||= {}
  OpenStruct.new(opts)
end

class MockRequest < OpenStruct
  def path; "#{script_name}#{path_info}" end
end

def mock_request(path_info = '/', script_name = '', extra_env = {})
  opts = {:path_info => path_info, :script_name => script_name}
  MockRequest.new(extra_env.merge(opts))
end