Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rubygem-faraday for openSUSE:Factory 
checked in at 2022-08-09 15:26:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-faraday (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-faraday.new.1521 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-faraday"

Tue Aug  9 15:26:28 2022 rev:29 rq:993480 version:2.4.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-faraday/rubygem-faraday.changes  
2022-06-15 00:32:23.390534459 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-faraday.new.1521/rubygem-faraday.changes    
    2022-08-09 15:26:38.421331685 +0200
@@ -1,0 +2,7 @@
+Thu Aug  4 13:09:44 UTC 2022 - Stephan Kulow <[email protected]>
+
+updated to version 2.4.0
+ see installed CHANGELOG.md
+
+
+-------------------------------------------------------------------

Old:
----
  faraday-2.3.0.gem

New:
----
  faraday-2.4.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-faraday.spec ++++++
--- /var/tmp/diff_new_pack.jiUMkH/_old  2022-08-09 15:26:38.869332964 +0200
+++ /var/tmp/diff_new_pack.jiUMkH/_new  2022-08-09 15:26:38.873332976 +0200
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-faraday
-Version:        2.3.0
+Version:        2.4.0
 Release:        0
 %define mod_name faraday
 %define mod_full_name %{mod_name}-%{version}

++++++ faraday-2.3.0.gem -> faraday-2.4.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/LICENSE.md new/LICENSE.md
--- old/LICENSE.md      2022-05-06 17:31:01.000000000 +0200
+++ new/LICENSE.md      2022-07-28 11:06:01.000000000 +0200
@@ -1,4 +1,4 @@
-Copyright (c) 2009-2020 Rick Olson, Zack Hobson
+Copyright (c) 2009-2022 Rick Olson, Zack Hobson
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2022-05-06 17:31:01.000000000 +0200
+++ new/README.md       2022-07-28 11:06:01.000000000 +0200
@@ -42,7 +42,7 @@
 But before you start coding, please read our [Contributing Guide][contributing]
 
 ## Copyright
-&copy; 2009 - 2021, the [Faraday Team][faraday_team]. Website and branding 
design by [Elena Lo Piccolo](https://elelopic.design).
+&copy; 2009 - 2022, the [Faraday Team][faraday_team]. Website and branding 
design by [Elena Lo Piccolo](https://elelopic.design).
 
 [awesome]:      https://github.com/lostisland/awesome-faraday/#adapters
 [website]:      https://lostisland.github.io/faraday
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/examples/client_spec.rb new/examples/client_spec.rb
--- old/examples/client_spec.rb 2022-05-06 17:31:01.000000000 +0200
+++ new/examples/client_spec.rb 2022-07-28 11:06:01.000000000 +0200
@@ -17,6 +17,11 @@
     data = JSON.parse(res.body)
     data['origin']
   end
+
+  def foo(params)
+    res = @conn.post('/foo', JSON.dump(params))
+    res.status
+  end
 end
 
 RSpec.describe Client do
@@ -94,4 +99,21 @@
       stubs.verify_stubbed_calls
     end
   end
+
+  context 'When you want to test the body, you can use a proc as well as 
string' do
+    it 'tests with a string' do
+      stubs.post('/foo', '{"name":"YK"}') { [200, {}, ''] }
+
+      expect(client.foo(name: 'YK')).to eq 200
+      stubs.verify_stubbed_calls
+    end
+
+    it 'tests with a proc' do
+      check = ->(request_body) { JSON.parse(request_body).slice('name') == { 
'name' => 'YK' } }
+      stubs.post('/foo', check) { [200, {}, ''] }
+
+      expect(client.foo(name: 'YK', created_at: Time.now)).to eq 200
+      stubs.verify_stubbed_calls
+    end
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/examples/client_test.rb new/examples/client_test.rb
--- old/examples/client_test.rb 2022-05-06 17:31:01.000000000 +0200
+++ new/examples/client_test.rb 2022-07-28 11:06:01.000000000 +0200
@@ -18,6 +18,11 @@
     data = JSON.parse(res.body)
     data['origin']
   end
+
+  def foo(params)
+    res = @conn.post('/foo', JSON.dump(params))
+    res.status
+  end
 end
 
 # Example API client test
@@ -109,6 +114,27 @@
     stubs.verify_stubbed_calls
   end
 
+  def test_with_string_body
+    stubs = Faraday::Adapter::Test::Stubs.new do |stub|
+      stub.post('/foo', '{"name":"YK"}') { [200, {}, ''] }
+    end
+    cli = client(stubs)
+    assert_equal 200, cli.foo(name: 'YK')
+
+    stubs.verify_stubbed_calls
+  end
+
+  def test_with_proc_body
+    stubs = Faraday::Adapter::Test::Stubs.new do |stub|
+      check = ->(request_body) { JSON.parse(request_body).slice('name') == { 
'name' => 'YK' } }
+      stub.post('/foo', check) { [200, {}, ''] }
+    end
+    cli = client(stubs)
+    assert_equal 200, cli.foo(name: 'YK', created_at: Time.now)
+
+    stubs.verify_stubbed_calls
+  end
+
   def client(stubs)
     conn = Faraday.new do |builder|
       builder.adapter :test, stubs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/faraday/adapter/test.rb 
new/lib/faraday/adapter/test.rb
--- old/lib/faraday/adapter/test.rb     2022-05-06 17:31:01.000000000 +0200
+++ new/lib/faraday/adapter/test.rb     2022-07-28 11:06:01.000000000 +0200
@@ -26,6 +26,15 @@
     #         ]
     #       end
     #
+    #      # Test the request body is the same as the stubbed body
+    #      stub.post('/bar', 'name=YK&word=call') { [200, {}, ''] }
+    #
+    #      # You can pass a proc as a stubbed body and check the request body 
in your way.
+    #      # In this case, the proc should return true or false.
+    #      stub.post('/foo', ->(request_body) do
+    #        JSON.parse(request_body).slice('name') == { 'name' => 'YK' } }) { 
[200, {}, '']
+    #      end
+    #
     #       # You can set strict_mode to exactly match the stubbed requests.
     #       stub.strict_mode = true
     #     end
@@ -42,6 +51,12 @@
     #
     #   resp = test.get '/items/2'
     #   resp.body # => 'showing item: 2'
+    #
+    #   resp = test.post '/bar', 'name=YK&word=call'
+    #   resp.status # => 200
+    #
+    #   resp = test.post '/foo', JSON.dump(name: 'YK', created_at: Time.now)
+    #   resp.status # => 200
     class Test < Faraday::Adapter
       attr_accessor :stubs
 
@@ -181,7 +196,7 @@
           [(host.nil? || host == request_host) &&
             path_match?(request_path, meta) &&
             params_match?(env) &&
-            (body.to_s.size.zero? || request_body == body) &&
+            body_match?(request_body) &&
             headers_match?(request_headers), meta]
         end
 
@@ -222,6 +237,17 @@
           end
         end
 
+        def body_match?(request_body)
+          return true if body.to_s.size.zero?
+
+          case body
+          when Proc
+            body.call(request_body)
+          else
+            request_body == body
+          end
+        end
+
         def to_s
           "#{path} #{body}"
         end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/faraday/options/ssl_options.rb 
new/lib/faraday/options/ssl_options.rb
--- old/lib/faraday/options/ssl_options.rb      2022-05-06 17:31:01.000000000 
+0200
+++ new/lib/faraday/options/ssl_options.rb      2022-07-28 11:06:01.000000000 
+0200
@@ -6,6 +6,10 @@
   # @!attribute verify
   #   @return [Boolean] whether to verify SSL certificates or not
   #
+  # @!attribute verify_hostname
+  #   @return [Boolean] whether to enable hostname verification on server 
certificates
+  #           during the handshake or not (see 
https://github.com/ruby/openssl/pull/60)
+  #
   # @!attribute ca_file
   #   @return [String] CA file
   #
@@ -41,7 +45,8 @@
   #
   # @!attribute max_version
   #   @return [String, Symbol] maximum SSL version (see 
https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL/SSLContext.html#method-i-max_version-3D)
-  class SSLOptions < Options.new(:verify, :ca_file, :ca_path, :verify_mode,
+  class SSLOptions < Options.new(:verify, :verify_hostname,
+                                 :ca_file, :ca_path, :verify_mode,
                                  :cert_store, :client_cert, :client_key,
                                  :certificate, :private_key, :verify_depth,
                                  :version, :min_version, :max_version)
@@ -55,5 +60,10 @@
     def disable?
       !verify?
     end
+
+    # @return [Boolean] true if should verify_hostname
+    def verify_hostname?
+      verify_hostname != false
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/faraday/version.rb new/lib/faraday/version.rb
--- old/lib/faraday/version.rb  2022-05-06 17:31:01.000000000 +0200
+++ new/lib/faraday/version.rb  2022-07-28 11:06:01.000000000 +0200
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
 
 module Faraday
-  VERSION = '2.3.0'
+  VERSION = '2.4.0'
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2022-05-06 17:31:01.000000000 +0200
+++ new/metadata        2022-07-28 11:06:01.000000000 +0200
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: faraday
 version: !ruby/object:Gem::Version
-  version: 2.3.0
+  version: 2.4.0
 platform: ruby
 authors:
 - "@technoweenie"
@@ -10,7 +10,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2022-05-06 00:00:00.000000000 Z
+date: 2022-07-28 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: faraday-net_http
@@ -125,7 +125,7 @@
 - MIT
 metadata:
   homepage_uri: https://lostisland.github.io/faraday
-  changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.3.0
+  changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.4.0
   source_code_uri: https://github.com/lostisland/faraday
   bug_tracker_uri: https://github.com/lostisland/faraday/issues
 post_install_message: 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/faraday/adapter/test_spec.rb 
new/spec/faraday/adapter/test_spec.rb
--- old/spec/faraday/adapter/test_spec.rb       2022-05-06 17:31:01.000000000 
+0200
+++ new/spec/faraday/adapter/test_spec.rb       2022-07-28 11:06:01.000000000 
+0200
@@ -373,5 +373,41 @@
       it_behaves_like 'does not raise NotFound even when headers do not 
satisfy the strict check', '/with_user_agent', { authorization: 'Bearer m_ck', 
user_agent: 'My Agent' }
       it_behaves_like 'does not raise NotFound even when headers do not 
satisfy the strict check', '/with_user_agent', { authorization: 'Bearer m_ck', 
user_agent: 'My Agent', x_special: 'special' }
     end
+
+    describe 'body_match?' do
+      let(:stubs) do
+        described_class::Stubs.new do |stubs|
+          stubs.post('/no_check') { [200, {}, 'ok'] }
+          stubs.post('/with_string', 'abc') { [200, {}, 'ok'] }
+          stubs.post(
+            '/with_proc',
+            ->(request_body) { JSON.parse(request_body, symbolize_names: true) 
== { x: '!', a: [{ m: [{ a: true }], n: 123 }] } },
+            { content_type: 'application/json' }
+          ) do
+            [200, {}, 'ok']
+          end
+        end
+      end
+
+      context 'when trying without any args for body' do
+        subject(:without_body) { connection.post('/no_check') }
+
+        it { expect(without_body.status).to eq 200 }
+      end
+
+      context 'when trying with string body stubs' do
+        subject(:with_string) { connection.post('/with_string', 'abc') }
+
+        it { expect(with_string.status).to eq 200 }
+      end
+
+      context 'when trying with proc body stubs' do
+        subject(:with_proc) do
+          connection.post('/with_proc', JSON.dump(a: [{ n: 123, m: [{ a: true 
}] }], x: '!'), { 'Content-Type' => 'application/json' })
+        end
+
+        it { expect(with_proc.status).to eq 200 }
+      end
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/faraday/connection_spec.rb 
new/spec/faraday/connection_spec.rb
--- old/spec/faraday/connection_spec.rb 2022-05-06 17:31:01.000000000 +0200
+++ new/spec/faraday/connection_spec.rb 2022-07-28 11:06:01.000000000 +0200
@@ -131,6 +131,12 @@
       it { expect(subject.ssl.verify?).to be_falsey }
     end
 
+    context 'with verify_hostname false' do
+      let(:options) { { ssl: { verify_hostname: false } } }
+
+      it { expect(subject.ssl.verify_hostname?).to be_falsey }
+    end
+
     context 'with empty block' do
       let(:conn) { Faraday::Connection.new {} }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/faraday/options/env_spec.rb 
new/spec/faraday/options/env_spec.rb
--- old/spec/faraday/options/env_spec.rb        2022-05-06 17:31:01.000000000 
+0200
+++ new/spec/faraday/options/env_spec.rb        2022-07-28 11:06:01.000000000 
+0200
@@ -27,6 +27,12 @@
     expect(ssl.fetch(:verify, true)).to be_falsey
   end
 
+  it 'handle verify_hostname when fetching' do
+    ssl = Faraday::SSLOptions.new
+    ssl.verify_hostname = true
+    expect(ssl.fetch(:verify_hostname, false)).to be_truthy
+  end
+
   it 'retains custom members' do
     env[:foo] = 'custom 1'
     env[:bar] = :custom2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/faraday/request_spec.rb 
new/spec/faraday/request_spec.rb
--- old/spec/faraday/request_spec.rb    2022-05-06 17:31:01.000000000 +0200
+++ new/spec/faraday/request_spec.rb    2022-07-28 11:06:01.000000000 +0200
@@ -14,6 +14,7 @@
   context 'when nothing particular is configured' do
     it { expect(subject.http_method).to eq(:get) }
     it { expect(subject.to_env(conn).ssl.verify).to be_falsey }
+    it { expect(subject.to_env(conn).ssl.verify_hostname).to be_falsey }
   end
 
   context 'when HTTP method is post' do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/faraday/utils_spec.rb 
new/spec/faraday/utils_spec.rb
--- old/spec/faraday/utils_spec.rb      2022-05-06 17:31:01.000000000 +0200
+++ new/spec/faraday/utils_spec.rb      2022-07-28 11:06:01.000000000 +0200
@@ -102,7 +102,8 @@
           verify_depth: nil,
           version: '2',
           min_version: nil,
-          max_version: nil
+          max_version: nil,
+          verify_hostname: nil
         }
       end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/support/shared_examples/adapter.rb 
new/spec/support/shared_examples/adapter.rb
--- old/spec/support/shared_examples/adapter.rb 2022-05-06 17:31:01.000000000 
+0200
+++ new/spec/support/shared_examples/adapter.rb 2022-07-28 11:06:01.000000000 
+0200
@@ -38,6 +38,7 @@
   let(:conn) do
     conn_options[:ssl] ||= {}
     conn_options[:ssl][:ca_file] ||= ENV['SSL_FILE']
+    conn_options[:ssl][:verify_hostname] ||= ENV['SSL_VERIFY_HOSTNAME'] == 
'yes'
 
     Faraday.new(remote, conn_options) do |conn|
       conn.request :url_encoded

Reply via email to