|
1 | | -require "spec_helper" |
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +require 'spec_helper' |
2 | 4 |
|
3 | 5 | RSpec.describe OpenApiParser::Document do |
4 | | - describe "self.resolve" do |
5 | | - context "yaml" do |
6 | | - it "resolves JSON pointers" do |
7 | | - path = File.expand_path("../../resources/pointer_example.yaml", __FILE__) |
| 6 | + describe 'self.resolve' do |
| 7 | + context 'yaml' do |
| 8 | + it 'resolves JSON pointers' do |
| 9 | + path = File.expand_path('../resources/pointer_example.yaml', __dir__) |
8 | 10 | json = OpenApiParser::Document.resolve(path) |
9 | 11 |
|
10 | | - expect(json["person"]).to eq({ |
11 | | - "name" => "Drew" |
12 | | - }) |
| 12 | + expect(json['person']).to eq( |
| 13 | + 'name' => 'Drew' |
| 14 | + ) |
13 | 15 | end |
14 | 16 |
|
15 | | - it "resolves JSON file references" do |
16 | | - path = File.expand_path("../../resources/file_reference_example.yaml", __FILE__) |
| 17 | + it 'resolves JSON file references' do |
| 18 | + path = File.expand_path('../resources/file_reference_example.yaml', __dir__) |
17 | 19 | json = OpenApiParser::Document.resolve(path) |
18 | 20 |
|
19 | | - expect(json["person"]).to eq({ |
20 | | - "name" => "Drew" |
21 | | - }) |
| 21 | + expect(json['person']).to eq( |
| 22 | + 'name' => 'Drew' |
| 23 | + ) |
22 | 24 |
|
23 | | - expect(json["person_without_scheme"]).to eq({ |
24 | | - "name" => "Drew" |
25 | | - }) |
| 25 | + expect(json['person_without_scheme']).to eq( |
| 26 | + 'name' => 'Drew' |
| 27 | + ) |
26 | 28 | end |
27 | 29 |
|
28 | | - it "resolves a mix of pointers and file references" do |
29 | | - path = File.expand_path("../../resources/mixed_reference_example.yaml", __FILE__) |
| 30 | + it 'resolves a mix of pointers and file references' do |
| 31 | + path = File.expand_path('../resources/mixed_reference_example.yaml', __dir__) |
30 | 32 | json = OpenApiParser::Document.resolve(path) |
31 | 33 |
|
32 | | - expect(json["person"]["greeting"]).to eq({ |
33 | | - "hi" => "Drew" |
34 | | - }) |
| 34 | + expect(json['person']['greeting']).to eq( |
| 35 | + 'hi' => 'Drew' |
| 36 | + ) |
35 | 37 |
|
36 | | - expect(json["person"]["stats"]).to eq({ |
37 | | - "age" => 34 |
38 | | - }) |
| 38 | + expect(json['person']['stats']).to eq( |
| 39 | + 'age' => 34 |
| 40 | + ) |
39 | 41 |
|
40 | | - expect(json["person_greeting"]).to eq("Drew") |
| 42 | + expect(json['person_greeting']).to eq('Drew') |
41 | 43 | end |
42 | 44 | end |
43 | 45 |
|
44 | | - context "json" do |
45 | | - it "resolves JSON pointers" do |
46 | | - path = File.expand_path("../../resources/pointer_example.json", __FILE__) |
| 46 | + context 'json' do |
| 47 | + it 'resolves JSON pointers' do |
| 48 | + path = File.expand_path('../resources/pointer_example.json', __dir__) |
47 | 49 | json = OpenApiParser::Document.resolve(path) |
48 | 50 |
|
49 | | - expect(json["person"]).to eq({ |
50 | | - "name" => "Drew" |
51 | | - }) |
| 51 | + expect(json['person']).to eq( |
| 52 | + 'name' => 'Drew' |
| 53 | + ) |
52 | 54 | end |
53 | 55 | end |
54 | 56 | end |
|
0 commit comments