!6 修复rubygem-sinatra测试用例失败

From: @cherry530
Reviewed-by: @small_leek
Signed-off-by: @small_leek
This commit is contained in:
openeuler-ci-bot 2021-12-03 08:03:51 +00:00 committed by Gitee
commit 32da2c7515
2 changed files with 31 additions and 1 deletions

25
Fix-failing-tests.patch Normal file
View File

@ -0,0 +1,25 @@
From 750aa3b0de06dad41539bdb402123b5416a3475d Mon Sep 17 00:00:00 2001
From: Jordan Owens <jkowens@gmail.com>
Date: Tue, 10 Mar 2020 10:24:05 -0400
Subject: [PATCH] Fix failing tests
Rack added support for Multi-part ranges and apparently changed the
format of cookie expires timestamp format to match specs.
---
test/static_test.rb | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/test/static_test.rb b/test/static_test.rb
index e8408b14e..1c6cb35e9 100644
--- a/test/static_test.rb
+++ b/test/static_test.rb
@@ -152,8 +152,7 @@ def assert_valid_range(http_range, range, path, file)
end
it 'correctly ignores syntactically invalid range requests' do
- # ...and also ignores multi-range requests, which aren't supported yet
- ["bytes=45-40", "bytes=IV-LXVI", "octets=10-20", "bytes=-", "bytes=1-2,3-4"].each do |http_range|
+ ["bytes=45-40", "bytes=IV-LXVI", "octets=10-20", "bytes=", "bytes=3-1,4-5"].each do |http_range|
request = Rack::MockRequest.new(@app)
response = request.get("/#{File.basename(__FILE__)}", 'HTTP_RANGE' => http_range)

View File

@ -3,11 +3,12 @@
Summary: Ruby-based web application framework
Name: rubygem-%{gem_name}
Version: 2.0.3
Release: 1
Release: 2
License: MIT
URL: http://www.sinatrarb.com/
Source0: https://rubygems.org/gems/sinatra-%{version}.gem
Source1: https://github.com/sinatra/sinatra/archive/v%{version}.tar.gz
Patch0: Fix-failing-tests.patch
BuildRequires: rubygems-devel
%if ! 0%{?bootstrap}
BuildRequires: rubygem(rack) >= 2.0 rubygem(rack-protection) = %{version} rubygem(tilt)
@ -47,6 +48,7 @@ sed -i -e 's|^#!/usr/bin/env ruby|#!/usr/bin/ruby|' \
pushd .%{gem_instdir}
tar xzvf %{SOURCE1}
cd %{gem_name}-%{version}
cat %{PATCH0} | patch -p1
for FILE in $(grep -rl '^require.*bundler.*' test/); do
sed -i "/^require 'bundler.*'/ s/^/#/" ${FILE}
done
@ -78,5 +80,8 @@ popd
%{gem_instdir}/examples
%changelog
* Fri Dec 03 2021 xu_ping <xuping33@huawei.com> - 2.0.3-2
- Fix tests failed
* Sat Aug 22 2020 liyanan <liyanan32@huawei.com> - 2.0.3-1
- package init