Sha256: 77db29a8de6a063126fd6cb89abd98b078ae85c5e6cac9dd305694f62a94adb4

Contents?: true

Size: 1.45 KB

Versions: 1

Compression:

Stored size: 1.45 KB

Contents

RSpec.describe OpenAPI::Loader do
  subject { described_class.call(source, **options) }

  let(:options) { {} }

  context "with OAS 2" do
    context "in YAML" do
      let(:source) { "spec/fixtures/oas2/source.yaml" }
      let(:target) { yaml_fixture_file "oas2/denormalized.yaml" }

      it { is_expected.to eq target }
    end

    context "in JSON" do
      let(:source) { "spec/fixtures/oas2/source.json" }
      let(:target) { yaml_fixture_file "oas2/denormalized.yaml" }

      it { is_expected.to eq target }
    end

    context "with option denormalize: false" do
      let(:source)  { "spec/fixtures/oas2/source.yaml" }
      let(:target)  { yaml_fixture_file "oas2/translated.yaml" }
      let(:options) { { denormalize: false } }

      it { is_expected.to eq target }
    end
  end

  context "with OAS 3" do
    context "in YAML" do
      let(:source) { "spec/fixtures/oas3/source.yaml" }
      let(:target) { yaml_fixture_file "oas3/denormalized.yaml" }

      it { is_expected.to eq target }
    end

    context "in JSON" do
      let(:source) { "spec/fixtures/oas3/source.json" }
      let(:target) { yaml_fixture_file "oas3/denormalized.yaml" }

      it { is_expected.to eq target }
    end

    context "with option denormalize: false" do
      let(:source)  { "spec/fixtures/oas3/source.yaml" }
      let(:target)  { yaml_fixture_file "oas3/collected.yaml" }
      let(:options) { { denormalize: false } }

      it { is_expected.to eq target }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
open_api-loader-0.0.1 spec/loader_spec.rb