1# encoding: UTF-8
2#
3# Licensed to the Apache Software Foundation (ASF) under one
4# or more contributor license agreements. See the NOTICE file
5# distributed with this work for additional information
6# regarding copyright ownership. The ASF licenses this file
7# to you under the Apache License, Version 2.0 (the
8# "License"); you may not use this file except in compliance
9# with the License. You may obtain a copy of the License at
10#
11#   http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing,
14# software distributed under the License is distributed on an
15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16# KIND, either express or implied. See the License for the
17# specific language governing permissions and limitations
18# under the License.
19#
20
21require 'rubygems'
22require 'rspec'
23
24$:.unshift File.join(File.dirname(__FILE__), *%w[.. ext])
25
26# pretend we already loaded fastthread, otherwise the nonblocking_server_spec
27# will get screwed up
28# $" << 'fastthread.bundle'
29
30require 'thrift'
31
32unless Object.method_defined? :tap
33  # if Object#tap isn't defined, then add it; this should only happen in Ruby < 1.8.7
34  class Object
35    def tap(&block)
36      block.call(self)
37      self
38    end
39  end
40end
41
42RSpec.configure do |configuration|
43  configuration.before(:each) do
44    Thrift.type_checking = true
45  end
46end
47
48$:.unshift File.join(File.dirname(__FILE__), *%w[.. test debug_proto gen-rb])
49require 'srv'
50require 'debug_proto_test_constants'
51
52$:.unshift File.join(File.dirname(__FILE__), *%w[gen-rb])
53require 'thrift_spec_types'
54require 'nonblocking_service'
55
56module Fixtures
57  COMPACT_PROTOCOL_TEST_STRUCT = Thrift::Test::COMPACT_TEST.dup
58  COMPACT_PROTOCOL_TEST_STRUCT.a_binary = [0,1,2,3,4,5,6,7,8].pack('c*')
59  COMPACT_PROTOCOL_TEST_STRUCT.set_byte_map = nil
60  COMPACT_PROTOCOL_TEST_STRUCT.map_byte_map = nil
61end
62
63$:.unshift File.join(File.dirname(__FILE__), *%w[gen-rb/flat])
64
65