blob: 893056c107527c6f3823e45510c89a5f2901237f [file] [log] [blame]
jfarrell4e167182015-01-29 23:03:34 -05001#
2# Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements. See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership. The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License. You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied. See the License for the
16# specific language governing permissions and limitations
17# under the License.
18#
19
20require 'spec_helper'
21
22describe 'generation' do
23 before do
24 require 'namespaced_nonblocking_service'
25 end
26
27 it "did not generate the wrong files" do
28 prefix = File.expand_path("../gen-rb/flat", __FILE__)
29 ["namespaced_spec_namespace/namespaced_nonblocking_service.rb",
30 "namespaced_spec_namespace/thrift_namespaced_spec_constants.rb",
31 "namespaced_spec_namespace/thrift_namespaced_spec_types.rb",
32 "other_namespace/referenced_constants.rb",
33 "other_namespace/referenced_types.rb"
34 ].each do |name|
James E. King III27247072018-03-22 20:50:23 -040035 expect(File.exist?(File.join(prefix, name))).not_to be_truthy
jfarrell4e167182015-01-29 23:03:34 -050036 end
37 end
38
39 it "generated the right files" do
40 prefix = File.expand_path("../gen-rb/flat", __FILE__)
41 ["namespaced_nonblocking_service.rb",
42 "thrift_namespaced_spec_constants.rb",
43 "thrift_namespaced_spec_types.rb",
44 "referenced_constants.rb",
45 "referenced_types.rb"
46 ].each do |name|
James E. King III27247072018-03-22 20:50:23 -040047 expect(File.exist?(File.join(prefix, name))).to be_truthy
jfarrell4e167182015-01-29 23:03:34 -050048 end
49 end
50
51 it "has a service class in the right place" do
James E. King III27247072018-03-22 20:50:23 -040052 expect(defined?(NamespacedSpecNamespace::NamespacedNonblockingService)).to be_truthy
jfarrell4e167182015-01-29 23:03:34 -050053 end
54
55 it "has a struct in the right place" do
James E. King III27247072018-03-22 20:50:23 -040056 expect(defined?(NamespacedSpecNamespace::Hello)).to be_truthy
jfarrell4e167182015-01-29 23:03:34 -050057 end
58
59 it "required an included file" do
James E. King III27247072018-03-22 20:50:23 -040060 expect(defined?(OtherNamespace::SomeEnum)).to be_truthy
jfarrell4e167182015-01-29 23:03:34 -050061 end
62end