Skip to content

Commit

Permalink
Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
exoego committed Mar 28, 2024
1 parent d8ea652 commit c941c62
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions spec/rspec/scheme_merger_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'schema merger spec' do
include SpecHelper

describe 'mixed symbol and strings' do
let(:base) do
{
'n' => 1,
'required' => %w[foo bar],
'a' => {
b1: 1,
b2: %w[foo bar],
'b3' => {
'c1' => 2,
c2: 3,
},
},
}
end

let(:spec) do
{
n: 1,
required: ['buz'],
a: {
'b1' => 1,
'b2' => %w[foo bar],
b3: {
c1: 2,
'c2' => 3,
},
},
}
end

it 'normalize keys to symbol' do
result = RSpec::OpenAPI::SchemaMerger.merge!(base, spec)
expect(result).to eq({
n: 1,
required: [],
a: {
b1: 1,
b2: %w[foo bar],
b3: {
c1: 2,
c2: 3,
},
},
})
end
end
end

0 comments on commit c941c62

Please sign in to comment.