Hello community,
here is the log from the commit of package rubygem-rack-test-0_6 for
openSUSE:Factory checked in at 2015-02-05 11:00:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-rack-test-0_6 (Old)
and /work/SRC/openSUSE:Factory/.rubygem-rack-test-0_6.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-rack-test-0_6"
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-rack-test-0_6/rubygem-rack-test-0_6.changes
2014-10-24 10:48:30.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-rack-test-0_6.new/rubygem-rack-test-0_6.changes
2015-02-05 11:01:07.000000000 +0100
@@ -1,0 +2,9 @@
+Wed Feb 4 12:36:31 UTC 2015 - [email protected]
+
+- updated to version 0.6.3
+ * Expose an env helper for persistently configuring the env as needed
+ * Expose the tempfile of UploadedFile (Sytse Sijbrandij #67)
+ * Improve support for arrays of hashes in multipart forms (Murray Steele #69)
+ * Improve test for query strings (Paul Grayson #66)
+
+-------------------------------------------------------------------
Old:
----
rack-test-0.6.2.gem
New:
----
rack-test-0.6.3.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-rack-test-0_6.spec ++++++
--- /var/tmp/diff_new_pack.wRu84U/_old 2015-02-05 11:01:08.000000000 +0100
+++ /var/tmp/diff_new_pack.wRu84U/_new 2015-02-05 11:01:08.000000000 +0100
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-rack-test-0_6
#
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
#
Name: rubygem-rack-test-0_6
-Version: 0.6.2
+Version: 0.6.3
Release: 0
%define mod_name rack-test
%define mod_full_name %{mod_name}-%{version}
++++++ rack-test-0.6.2.gem -> rack-test-0.6.3.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Gemfile new/Gemfile
--- old/Gemfile 1970-01-01 01:00:00.000000000 +0100
+++ new/Gemfile 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +1,8 @@
-source :rubygems
+source 'https://rubygems.org'
gem 'rspec'
gem "rack"
gem "sinatra"
gem 'rake'
+
+gem "codeclimate-test-reporter", group: :test, require: nil
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Gemfile.lock new/Gemfile.lock
--- old/Gemfile.lock 1970-01-01 01:00:00.000000000 +0100
+++ new/Gemfile.lock 1970-01-01 01:00:00.000000000 +0100
@@ -1,30 +1,40 @@
GEM
- remote: http://rubygems.org/
+ remote: https://rubygems.org/
specs:
- diff-lcs (1.1.3)
- rack (1.4.0)
- rack-protection (1.2.0)
+ codeclimate-test-reporter (0.3.0)
+ simplecov (>= 0.7.1, < 1.0.0)
+ diff-lcs (1.2.3)
+ docile (1.1.3)
+ multi_json (1.9.0)
+ rack (1.5.2)
+ rack-protection (1.5.0)
rack
- rake (0.9.2)
- rspec (2.8.0)
- rspec-core (~> 2.8.0)
- rspec-expectations (~> 2.8.0)
- rspec-mocks (~> 2.8.0)
- rspec-core (2.8.0)
- rspec-expectations (2.8.0)
- diff-lcs (~> 1.1.2)
- rspec-mocks (2.8.0)
- sinatra (1.3.2)
- rack (~> 1.3, >= 1.3.6)
- rack-protection (~> 1.2)
- tilt (~> 1.3, >= 1.3.3)
- tilt (1.3.3)
+ rake (10.0.4)
+ rspec (2.13.0)
+ rspec-core (~> 2.13.0)
+ rspec-expectations (~> 2.13.0)
+ rspec-mocks (~> 2.13.0)
+ rspec-core (2.13.1)
+ rspec-expectations (2.13.0)
+ diff-lcs (>= 1.1.3, < 2.0)
+ rspec-mocks (2.13.1)
+ simplecov (0.8.2)
+ docile (~> 1.1.0)
+ multi_json
+ simplecov-html (~> 0.8.0)
+ simplecov-html (0.8.0)
+ sinatra (1.4.2)
+ rack (~> 1.5, >= 1.5.2)
+ rack-protection (~> 1.4)
+ tilt (~> 1.3, >= 1.3.4)
+ tilt (1.3.7)
PLATFORMS
java
ruby
DEPENDENCIES
+ codeclimate-test-reporter
rack
rake
rspec
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/History.txt new/History.txt
--- old/History.txt 1970-01-01 01:00:00.000000000 +0100
+++ new/History.txt 1970-01-01 01:00:00.000000000 +0100
@@ -1,3 +1,16 @@
+== 0.6.3 / 2015-01-09
+
+* Minor enhancements
+
+ * Expose an env helper for persistently configuring the env as needed
+ (DarĂo Javier Cravero #80)
+ * Expose the tempfile of UploadedFile (Sytse Sijbrandij #67)
+
+* Bug fixes
+
+ * Improve support for arrays of hashes in multipart forms (Murray Steele #69)
+ * Improve test for query strings (Paul Grayson #66)
+
== 0.6.2 / 2012-09-27
* Minor enhancements
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.rdoc new/README.rdoc
--- old/README.rdoc 1970-01-01 01:00:00.000000000 +0100
+++ new/README.rdoc 1970-01-01 01:00:00.000000000 +0100
@@ -1,4 +1,4 @@
-= Rack::Test {<img src="https://codeclimate.com/badge.png"
/>}[https://codeclimate.com/github/brynary/rack-test]
+= Rack::Test {<img src="https://codeclimate.com/github/brynary/rack-test.png"
/>}[https://codeclimate.com/github/brynary/rack-test] {<img
src="https://codeclimate.com/github/brynary/rack-test/coverage.png"
/>}[https://codeclimate.com/github/brynary/rack-test]
- Code: http://github.com/brynary/rack-test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rack/test/methods.rb new/lib/rack/test/methods.rb
--- old/lib/rack/test/methods.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/rack/test/methods.rb 1970-01-01 01:00:00.000000000 +0100
@@ -67,6 +67,7 @@
:head,
:follow_redirect!,
:header,
+ :env,
:set_cookie,
:clear_cookies,
:authorize,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rack/test/uploaded_file.rb
new/lib/rack/test/uploaded_file.rb
--- old/lib/rack/test/uploaded_file.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/rack/test/uploaded_file.rb 1970-01-01 01:00:00.000000000 +0100
@@ -14,6 +14,9 @@
# The filename, *not* including the path, of the "uploaded" file
attr_reader :original_filename
+ # The tempfile
+ attr_reader :tempfile
+
# The content type of the "uploaded" file
attr_accessor :content_type
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rack/test/utils.rb new/lib/rack/test/utils.rb
--- old/lib/rack/test/utils.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/rack/test/utils.rb 1970-01-01 01:00:00.000000000 +0100
@@ -57,9 +57,12 @@
value.map do |v|
if (v.is_a?(Hash))
+ nested_params = {}
build_multipart(v, false).each { |subkey, subvalue|
- flattened_params["#{k}[]#{subkey}"] = subvalue
+ nested_params[subkey] = subvalue
}
+ flattened_params["#{k}[]"] ||= []
+ flattened_params["#{k}[]"] << nested_params
else
flattened_params["#{k}[]"] = value
end
@@ -85,21 +88,32 @@
private
def build_parts(parameters)
- parameters.map { |name, value|
- if value.respond_to?(:original_filename)
- build_file_part(name, value)
-
- elsif value.is_a?(Array) and value.all? { |v|
v.respond_to?(:original_filename) }
- value.map do |v|
- build_file_part(name, v)
- end.join
+ get_parts(parameters).join + "--#{MULTIPART_BOUNDARY}--\r"
+ end
+ def get_parts(parameters)
+ parameters.map { |name, value|
+ if name =~ /\[\]\Z/ && value.is_a?(Array) && value.all? {|v|
v.is_a?(Hash)}
+ value.map { |hash|
+ new_value = {}
+ hash.each { |k, v| new_value[name+k] = v }
+ get_parts(new_value).join
+ }.join
else
- primitive_part = build_primitive_part(name, value)
- Rack::Test.encoding_aware_strings? ?
primitive_part.force_encoding('BINARY') : primitive_part
- end
+ if value.respond_to?(:original_filename)
+ build_file_part(name, value)
- }.join + "--#{MULTIPART_BOUNDARY}--\r"
+ elsif value.is_a?(Array) and value.all? { |v|
v.respond_to?(:original_filename) }
+ value.map do |v|
+ build_file_part(name, v)
+ end.join
+
+ else
+ primitive_part = build_primitive_part(name, value)
+ Rack::Test.encoding_aware_strings? ?
primitive_part.force_encoding('BINARY') : primitive_part
+ end
+ end
+ }
end
def build_primitive_part(parameter_name, value)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rack/test.rb new/lib/rack/test.rb
--- old/lib/rack/test.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/rack/test.rb 1970-01-01 01:00:00.000000000 +0100
@@ -9,7 +9,7 @@
module Rack
module Test
- VERSION = "0.6.2"
+ VERSION = "0.6.3"
DEFAULT_HOST = "example.org"
MULTIPART_BOUNDARY = "----------XnJLe9ZIbbGUYtzPQJ16u1"
@@ -35,6 +35,7 @@
# (See README.rdoc for an example)
def initialize(mock_session)
@headers = {}
+ @env = {}
if mock_session.is_a?(MockSession)
@rack_mock_session = mock_session
@@ -139,6 +140,19 @@
end
end
+ # Set an env var to be included on all subsequent requests through the
+ # session. Use a value of nil to remove a previously configured env.
+ #
+ # Example:
+ # env "rack.session", {:csrf => 'token'}
+ def env(name, value)
+ if value.nil?
+ @env.delete(name)
+ else
+ @env[name] = value
+ end
+ end
+
# Set the username and password for HTTP Basic authorization, to be
# included in subsequent requests in the HTTP_AUTHORIZATION header.
#
@@ -271,7 +285,7 @@
end
def default_env
- { "rack.test" => true, "REMOTE_ADDR" => "127.0.0.1"
}.merge(headers_for_env)
+ { "rack.test" => true, "REMOTE_ADDR" => "127.0.0.1"
}.merge(@env).merge(headers_for_env)
end
def headers_for_env
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 1970-01-01 01:00:00.000000000 +0100
+++ new/metadata 1970-01-01 01:00:00.000000000 +0100
@@ -1,7 +1,7 @@
--- !ruby/object:Gem::Specification
name: rack-test
version: !ruby/object:Gem::Version
- version: 0.6.2
+ version: 0.6.3
prerelease:
platform: ruby
authors:
@@ -9,7 +9,7 @@
autorequire:
bindir: bin
cert_chain: []
-date: 2012-09-27 00:00:00.000000000 Z
+date: 2015-01-09 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: rack
@@ -92,7 +92,7 @@
version: '0'
requirements: []
rubyforge_project: rack-test
-rubygems_version: 1.8.23
+rubygems_version: 1.8.23.2
signing_key:
specification_version: 3
summary: Simple testing API built on Rack
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/rack-test.gemspec new/rack-test.gemspec
--- old/rack-test.gemspec 1970-01-01 01:00:00.000000000 +0100
+++ new/rack-test.gemspec 1970-01-01 01:00:00.000000000 +0100
@@ -2,11 +2,11 @@
Gem::Specification.new do |s|
s.name = "rack-test"
- s.version = "0.6.2"
+ s.version = "0.6.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to?
:required_rubygems_version=
s.authors = ["Bryan Helmkamp"]
- s.date = "2012-09-27"
+ s.date = "2015-01-09"
s.description = "Rack::Test is a small, simple testing API for Rack apps. It
can be used on its\nown or as a reusable starting point for Web frameworks and
testing libraries\nto build on. Most of its initial functionality is an
extraction of Merb 1.0's\nrequest helpers feature."
s.email = "[email protected]"
s.extra_rdoc_files = [
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/rack/test/uploaded_file_spec.rb
new/spec/rack/test/uploaded_file_spec.rb
--- old/spec/rack/test/uploaded_file_spec.rb 1970-01-01 01:00:00.000000000
+0100
+++ new/spec/rack/test/uploaded_file_spec.rb 1970-01-01 01:00:00.000000000
+0100
@@ -17,6 +17,8 @@
uploaded_file.should respond_to(:size)
uploaded_file.should respond_to(:unlink)
uploaded_file.should respond_to(:read)
+ uploaded_file.should respond_to(:original_filename)
+ uploaded_file.should respond_to(:tempfile) # Allows calls to
params[:file].tempfile
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/rack/test/utils_spec.rb
new/spec/rack/test/utils_spec.rb
--- old/spec/rack/test/utils_spec.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/spec/rack/test/utils_spec.rb 1970-01-01 01:00:00.000000000 +0100
@@ -104,6 +104,77 @@
check params["foo"].should == ["1", "2"]
end
+ it "builds nested multipart bodies with an array of hashes" do
+ files = Rack::Test::UploadedFile.new(multipart_file("foo.txt"))
+ data = build_multipart("files" => files, "foo" => [{"id" => "1", "name"
=> 'Dave'}, {"id" => "2", "name" => 'Steve'}])
+
+ options = {
+ "CONTENT_TYPE" => "multipart/form-data;
boundary=#{Rack::Test::MULTIPART_BOUNDARY}",
+ "CONTENT_LENGTH" => data.length.to_s,
+ :input => StringIO.new(data)
+ }
+ env = Rack::MockRequest.env_for("/", options)
+ params = Rack::Utils::Multipart.parse_multipart(env)
+ check params["files"][:filename].should == "foo.txt"
+ params["files"][:tempfile].read.should == "bar\n"
+ check params["foo"].should == [{"id" => "1", "name" => "Dave"}, {"id" =>
"2", "name" => "Steve"}]
+ end
+
+ it "builds nested multipart bodies with arbitrarily nested array of
hashes" do
+ files = Rack::Test::UploadedFile.new(multipart_file("foo.txt"))
+ data = build_multipart("files" => files, "foo" => {"bar" => [{"id" =>
"1", "name" => 'Dave'},
+ {"id" =>
"2", "name" => 'Steve', "qux" => [{"id" => '3', "name" => 'mike'},
+
{"id" => '4', "name" => 'Joan'}]}]})
+
+ options = {
+ "CONTENT_TYPE" => "multipart/form-data;
boundary=#{Rack::Test::MULTIPART_BOUNDARY}",
+ "CONTENT_LENGTH" => data.length.to_s,
+ :input => StringIO.new(data)
+ }
+ env = Rack::MockRequest.env_for("/", options)
+ params = Rack::Utils::Multipart.parse_multipart(env)
+ check params["files"][:filename].should == "foo.txt"
+ params["files"][:tempfile].read.should == "bar\n"
+ check params["foo"].should == {"bar" => [{"id" => "1", "name" => "Dave"},
+ {"id" => "2", "name" =>
"Steve", "qux" => [{"id" => '3', "name" => 'mike'},
+
{"id" => '4', "name" => 'Joan'}]}]}
+ end
+
+ it 'does not break with params that look nested, but are not' do
+ files = Rack::Test::UploadedFile.new(multipart_file("foo.txt"))
+ data = build_multipart("foo[]" => "1", "bar[]" => {"qux" => "2"},
"files[]" => files)
+
+ options = {
+ "CONTENT_TYPE" => "multipart/form-data;
boundary=#{Rack::Test::MULTIPART_BOUNDARY}",
+ "CONTENT_LENGTH" => data.length.to_s,
+ :input => StringIO.new(data)
+ }
+ env = Rack::MockRequest.env_for("/", options)
+ params = Rack::Utils::Multipart.parse_multipart(env)
+ check params["files"][0][:filename].should == "foo.txt"
+ params["files"][0][:tempfile].read.should == "bar\n"
+ check params["foo"][0].should == "1"
+ check params["bar"][0].should == {"qux" => "2"}
+ end
+
+ it 'allows for nested files' do
+ files = Rack::Test::UploadedFile.new(multipart_file("foo.txt"))
+ data = build_multipart("foo" => [{"id" => "1", "data" => files},
+ {"id" => "2", "data" => ["3", "4"]}])
+
+ options = {
+ "CONTENT_TYPE" => "multipart/form-data;
boundary=#{Rack::Test::MULTIPART_BOUNDARY}",
+ "CONTENT_LENGTH" => data.length.to_s,
+ :input => StringIO.new(data)
+ }
+ env = Rack::MockRequest.env_for("/", options)
+ params = Rack::Utils::Multipart.parse_multipart(env)
+ check params["foo"][0]["id"].should == "1"
+ check params["foo"][0]["data"][:filename].should == "foo.txt"
+ params["foo"][0]["data"][:tempfile].read.should == "bar\n"
+ check params["foo"][1].should == {"id" => "2", "data" => ["3", "4"]}
+ end
+
it "returns nil if no UploadedFiles were used" do
data = build_multipart("people" => [{"submit-name" => "Larry", "files"
=> "contents"}])
data.should be_nil
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/rack/test_spec.rb new/spec/rack/test_spec.rb
--- old/spec/rack/test_spec.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/spec/rack/test_spec.rb 1970-01-01 01:00:00.000000000 +0100
@@ -123,8 +123,8 @@
end
it "does not rewrite a GET query string when :params is not supplied" do
- request "/foo?a=1&b=2&c=3&e=4&d=5"
- last_request.query_string.should == "a=1&b=2&c=3&e=4&d=5"
+ request "/foo?a=1&b=2&c=3&e=4&d=5+%20"
+ last_request.query_string.should == "a=1&b=2&c=3&e=4&d=5+%20"
end
it "accepts params and builds url encoded params for POST requests" do
@@ -289,6 +289,46 @@
end
end
+ describe "#env" do
+ it "sets the env to be sent with requests" do
+ env "rack.session", {:csrf => 'token'}
+ request "/"
+
+ last_request.env["rack.session"].should == {:csrf => 'token'}
+ end
+
+ it "persists across multiple requests" do
+ env "rack.session", {:csrf => 'token'}
+ request "/"
+ request "/"
+
+ last_request.env["rack.session"].should == {:csrf => 'token'}
+ end
+
+ it "overwrites previously set envs" do
+ env "rack.session", {:csrf => 'token'}
+ env "rack.session", {:some => :thing}
+ request "/"
+
+ last_request.env["rack.session"].should == {:some => :thing}
+ end
+
+ it "can be used to clear a env" do
+ env "rack.session", {:csrf => 'token'}
+ env "rack.session", nil
+ request "/"
+
+ last_request.env.should_not have_key("X_CSRF_TOKEN")
+ end
+
+ it "is overridden by envs sent during the request" do
+ env "rack.session", {:csrf => 'token'}
+ request "/", "rack.session" => {:some => :thing}
+
+ last_request.env["rack.session"].should == {:some => :thing}
+ end
+ end
+
describe "#authorize" do
it "sets the HTTP_AUTHORIZATION header" do
authorize "bryan", "secret"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/spec_helper.rb new/spec/spec_helper.rb
--- old/spec/spec_helper.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/spec/spec_helper.rb 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +1,9 @@
require "rubygems"
require "bundler/setup"
+require "codeclimate-test-reporter"
+CodeClimate::TestReporter.start
+
require "rack"
require "rspec"
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]