jfarrell | 4e16718 | 2015-01-29 23:03:34 -0500 | [diff] [blame] | 1 | # |
| 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 | |
| 20 | require 'spec_helper' |
| 21 | |
| 22 | describe '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 III | 2724707 | 2018-03-22 20:50:23 -0400 | [diff] [blame] | 35 | expect(File.exist?(File.join(prefix, name))).not_to be_truthy |
jfarrell | 4e16718 | 2015-01-29 23:03:34 -0500 | [diff] [blame] | 36 | 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 III | 2724707 | 2018-03-22 20:50:23 -0400 | [diff] [blame] | 47 | expect(File.exist?(File.join(prefix, name))).to be_truthy |
jfarrell | 4e16718 | 2015-01-29 23:03:34 -0500 | [diff] [blame] | 48 | end |
| 49 | end |
| 50 | |
| 51 | it "has a service class in the right place" do |
James E. King III | 2724707 | 2018-03-22 20:50:23 -0400 | [diff] [blame] | 52 | expect(defined?(NamespacedSpecNamespace::NamespacedNonblockingService)).to be_truthy |
jfarrell | 4e16718 | 2015-01-29 23:03:34 -0500 | [diff] [blame] | 53 | end |
| 54 | |
| 55 | it "has a struct in the right place" do |
James E. King III | 2724707 | 2018-03-22 20:50:23 -0400 | [diff] [blame] | 56 | expect(defined?(NamespacedSpecNamespace::Hello)).to be_truthy |
jfarrell | 4e16718 | 2015-01-29 23:03:34 -0500 | [diff] [blame] | 57 | end |
| 58 | |
| 59 | it "required an included file" do |
James E. King III | 2724707 | 2018-03-22 20:50:23 -0400 | [diff] [blame] | 60 | expect(defined?(OtherNamespace::SomeEnum)).to be_truthy |
jfarrell | 4e16718 | 2015-01-29 23:03:34 -0500 | [diff] [blame] | 61 | end |
| 62 | end |