From fa316c4c7bcea345d0053c823e8596a54471409c Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Fri, 26 Apr 2024 15:34:02 -0400 Subject: [PATCH] Added Rack version specs to ensure the correct version is loaded. --- spec/integration/rack_2_0/headers_spec.rb | 2 +- spec/integration/rack_2_0/version_spec.rb | 5 +++++ spec/integration/rack_3_0/headers_spec.rb | 2 +- spec/integration/rack_3_0/version_spec.rb | 5 +++++ 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 spec/integration/rack_2_0/version_spec.rb create mode 100644 spec/integration/rack_3_0/version_spec.rb diff --git a/spec/integration/rack_2_0/headers_spec.rb b/spec/integration/rack_2_0/headers_spec.rb index ad3408019a..4819f21dc1 100644 --- a/spec/integration/rack_2_0/headers_spec.rb +++ b/spec/integration/rack_2_0/headers_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe Grape::Http::Headers, if: Gem::Version.new(Rack.release) < Gem::Version.new('3.0.0') do +describe Grape::Http::Headers do it { expect(described_class::ALLOW).to eq('Allow') } it { expect(described_class::LOCATION).to eq('Location') } it { expect(described_class::TRANSFER_ENCODING).to eq('Transfer-Encoding') } diff --git a/spec/integration/rack_2_0/version_spec.rb b/spec/integration/rack_2_0/version_spec.rb new file mode 100644 index 0000000000..45b4454c95 --- /dev/null +++ b/spec/integration/rack_2_0/version_spec.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +describe Rack do + it { expect(Gem::Version.new(described_class.release).segments.first).to eq 2 } +end diff --git a/spec/integration/rack_3_0/headers_spec.rb b/spec/integration/rack_3_0/headers_spec.rb index 1007cd4389..3be2c1e28b 100644 --- a/spec/integration/rack_3_0/headers_spec.rb +++ b/spec/integration/rack_3_0/headers_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe Grape::Http::Headers, if: Gem::Version.new(Rack.release) >= Gem::Version.new('3') do +describe Grape::Http::Headers do it { expect(described_class::ALLOW).to eq('allow') } it { expect(described_class::LOCATION).to eq('location') } it { expect(described_class::TRANSFER_ENCODING).to eq('transfer-encoding') } diff --git a/spec/integration/rack_3_0/version_spec.rb b/spec/integration/rack_3_0/version_spec.rb new file mode 100644 index 0000000000..1352ee6a5e --- /dev/null +++ b/spec/integration/rack_3_0/version_spec.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +describe Rack do + it { expect(Gem::Version.new(described_class.release).segments.first).to eq 3 } +end