Sha256: d353f288c7eaced5453fa778edfae4dfefc1d48fe31575ccd8a1a7b2d02ae254

Contents?: true

Size: 1.09 KB

Versions: 7

Compression:

Stored size: 1.09 KB

Contents

require_relative "../test_helper"

module Unit
  class TestConnection < Minitest::Test

    describe GoogleApis::Connection do
      describe "#initialize" do
        it "instantiates a Google::APIClient and Google::APIClient::JWTAsserter" do
          Google::APIClient.expects(:new).with({
            :application_name => "rubygem:google-apis",
            :application_version => GoogleApis::VERSION
          }).returns("< client >")

          File.expects(:open).with("< private_key >", "rb").returns("< file >")
          Google::APIClient::PKCS12.expects(:load_key).with("< file >", "notasecret").returns("< key >")
          Google::APIClient::JWTAsserter.expects(:new).with("< email_address >", "", "< key >").returns("< asserter >")

          connection = GoogleApis::Connection.new(
            :email_address => "< email_address >",
            :private_key => "< private_key >"
          )

          assert_equal "< client >", connection.instance_variable_get(:@client)
          assert_equal "< asserter >", connection.instance_variable_get(:@asserter)
        end
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
google-apis-0.1.7 test/unit/test_connection.rb
google-apis-0.1.6 test/unit/test_connection.rb
google-apis-0.1.5 test/unit/test_connection.rb
google-apis-0.1.4 test/unit/test_connection.rb
google-apis-0.1.3 test/unit/test_connection.rb
google-apis-0.1.2 test/unit/test_connection.rb
google-apis-0.1.1 test/unit/test_connection.rb