Update to rack-protection 2.0.0.

f38
Jun Aruga 8 years ago
parent d916622b07
commit 3f9beb2b92

2
.gitignore vendored

@ -2,3 +2,5 @@
/rack-protection-1.3.2.gem
/rack-protection-1.5.0.gem
/rack-protection-1.5.3.gem
/rack-protection-2.0.0-tests.tgz
/rack-protection-2.0.0.gem

@ -1,51 +0,0 @@
From df93a5a78dd555e933396a5fc7f74e81e97d7cb5 Mon Sep 17 00:00:00 2001
From: Jun Aruga <jaruga@redhat.com>
Date: Mon, 6 Feb 2017 21:25:10 +0100
Subject: [PATCH] RSpec 3 compatibility.
---
spec/protection_spec.rb | 6 +++---
spec/spec_helper.rb | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/spec/protection_spec.rb b/spec/protection_spec.rb
index 083670c..c15a544 100755
--- a/spec/protection_spec.rb
+++ b/spec/protection_spec.rb
@@ -68,17 +68,17 @@ describe Rack::Protection do
describe "#html?" do
context "given an appropriate content-type header" do
subject { Rack::Protection::Base.new(nil).html? 'content-type' => "text/html" }
- it { should be_true }
+ it { should be_truthy }
end
context "given an inappropriate content-type header" do
subject { Rack::Protection::Base.new(nil).html? 'content-type' => "image/gif" }
- it { should be_false }
+ it { should be_falsey }
end
context "given no content-type header" do
subject { Rack::Protection::Base.new(nil).html?({}) }
- it { should be_false }
+ it { should be_falsey }
end
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 6a3a8f8..5caccd8 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -93,7 +93,7 @@ module NotImplementedAsPending
end
RSpec.configure do |config|
- config.expect_with :rspec, :stdlib
+ config.expect_with :rspec
config.include Rack::Test::Methods
config.include TestHelpers
end
--
2.7.4

@ -1,20 +1,21 @@
%global gem_name rack-protection
%global bootstrap 0
%{?_with_bootstrap: %global bootstrap 1}
Summary: Ruby gem that protects against typical web attacks
Name: rubygem-%{gem_name}
Version: 1.5.3
Release: 4%{?dist}
Group: Development/Languages
Version: 2.0.0
Release: 1%{?dist}
License: MIT
URL: http://github.com/rkh/rack-protection
Source0: http://rubygems.org/downloads/%{gem_name}-%{version}.gem
# rack-protection was merged to sinatra 2. It is RSpec3 compatibility.
Patch0: rubygem-rack-protection-1.5.3-rspec3-compatibility.patch
URL: http://github.com/sinatra/sinatra/tree/master/rack-protection
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# git clone https://github.com/sinatra/sinatra.git && cd sinatra/rack-protection
# git checkout v2.0.0 && tar czvf rack-protection-2.0.0-tests.tgz spec/
Source1: %{gem_name}-%{version}-tests.tgz
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
%if 0%{bootstrap} < 1
BuildRequires: rubygem(test-unit)
BuildRequires: ruby
%if ! 0%{?bootstrap}
BuildRequires: rubygem(rack)
BuildRequires: rubygem(rspec)
BuildRequires: rubygem(rack-test)
@ -27,7 +28,6 @@ Should work for all Rack apps, including Rails.
%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
@ -37,16 +37,15 @@ This package contains documentation for %{name}.
%prep
%setup -q -c -T
%gem_install -n %{SOURCE0}
rm .%{gem_instdir}/%{gem_name}.gemspec
rm .%{gem_cache}
%build
%if ! 0%{?bootstrap}
%check
%if 0%{bootstrap} < 1
pushd .%{gem_instdir}
cat %{PATCH0} | patch -p1
rspec spec
tar xzvf %{SOURCE1}
rspec -r 'spec_helper' spec
popd
%endif
@ -54,24 +53,24 @@ popd
%{__mkdir_p} %{buildroot}%{gem_dir}
cp -rv .%{gem_dir}/* %{buildroot}%{gem_dir}
# Fix presmissions.
# https://github.com/rkh/rack-protection/pull/93
chmod a-x %{buildroot}%{gem_instdir}/lib/rack/protection/base.rb
chmod a-x %{buildroot}%{gem_instdir}/spec/protection_spec.rb
%files
%dir %{gem_instdir}
%license %{gem_instdir}/License
%{gem_libdir}
%exclude %{gem_instdir}/rack-protection.gemspec
%exclude %{gem_cache}
%{gem_spec}
%license %{gem_instdir}/License
%files doc
%doc %{gem_docdir}
%{gem_instdir}/Gemfile
%doc %{gem_instdir}/README.md
%{gem_instdir}/Rakefile
%{gem_instdir}/spec
%doc %{gem_docdir}
%changelog
* Mon Jun 19 2017 Jun Aruga <jaruga@redhat.com> - 2.0.0-1
- Update to rack-protection 2.0.0.
* Tue Feb 07 2017 Jun Aruga <jaruga@redhat.com> - 1.5.3-4
- Fix for RSpec 3 compatibility.

@ -1 +1,2 @@
SHA512 (rack-protection-1.5.3.gem) = 9f94f9f25197c3f8227f5c9c9fd2e896e35bfc08d4a20f4dded9c42772f348d16dceda6916429833b498b29c4dbba4dbb31b1a3cf90de597fb6df2de145d655a
SHA512 (rack-protection-2.0.0-tests.tgz) = d369c878614ae8710c752227303b21629714b27ab39ba52e49ae2ae79661645f00ff3843dd07d43d4296e2c11d3009005dda9ecd5dc1ca6e51206c190127e8eb
SHA512 (rack-protection-2.0.0.gem) = cce6a8a64c502e4cfec47ae3d76e71aef42b1eec5aa4802a6c443fcb7a8971a99ad9a5b34fea7ae878630faba10d4f5bde4d9a3eb66f63600fcaf02d9ecc0c2e

Loading…
Cancel
Save