Sha256: 54965791753ade3be71fb8c79967736cb4b7336a69f66b6815979d558c9d9cfe

Contents?: true

Size: 1.25 KB

Versions: 50

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe Ridley::Middleware::ChefAuth do
  let(:server_url) { "https://api.opscode.com/organizations/vialstudios/" }

  describe "ClassMethods" do
    subject { described_class }

    describe "#authentication_headers" do
      let(:client_name) { "reset" }
      let(:client_key) { fixtures_path.join("reset.pem") }

      it "returns a Hash of authentication headers" do
        options = {
          http_method: "GET",
          host: "https://api.opscode.com",
          path: "/something.file"
        }
        subject.authentication_headers(client_name, client_key, options).should be_a(Hash)
      end

      context "when the :client_key is an actual key" do
        let(:client_key) { File.read(fixtures_path.join("reset.pem")) }

        it "returns a Hash of authentication headers" do
          options = {
            http_method: "GET",
            host: "https://api.opscode.com",
            path: "/something.file"
          }
          subject.authentication_headers(client_name, client_key, options).should be_a(Hash)
        end
      end
    end
  end

  subject do
    Faraday.new(server_url) do |conn|
      conn.request :chef_auth, "reset", "/Users/reset/.chef/reset.pem"
      conn.adapter Faraday.default_adapter
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
ridley-4.2.0 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-4.1.2 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-4.1.1 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-4.1.0 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-4.0.0 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-3.1.0 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-3.0.0 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-3.0.0.rc1 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-2.5.1 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-2.5.0 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-2.4.4 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-2.4.3 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-2.4.2 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-2.4.1 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-2.4.0 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-2.3.0 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-2.2.0 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-2.1.0 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-2.0.0 spec/unit/ridley/middleware/chef_auth_spec.rb
ridley-1.7.1 spec/unit/ridley/middleware/chef_auth_spec.rb