<commit_before>require 'spec_helper'
require 'contentful/management/client'

module Contentful
  module Management
    describe Client do
      let(:token) { '<ACCESS_TOKEN>' }
      let(:client) { Client.new(token) }

      subject { client }

      its(:access_token) { should be token }

      describe 'headers' do
        describe '#authentication_header' do
          its(:authentication_header) { should be_kind_of Hash }
          its(:authentication_header) { should eql 'Authorization' => 'Bearer <ACCESS_TOKEN>' }
        end

        describe '#api_version_header' do
          its(:api_version_header) { should be_kind_of Hash }
          its(:api_version_header) { should eql 'Content-Type' => 'application/vnd.contentful.management.v1+json' }
        end

        describe '#request_headers' do
          its(:request_headers) { should be_kind_of Hash }
          its(:request_headers) { should include client.authentication_header }
          its(:request_headers) { should include client.api_version_header }
          its(:request_headers) { should include client.user_agent }
        end

        describe '#user_agent' do
          its(:user_agent) { should be_kind_of Hash }
          its(:user_agent) { should eq 'User-Agent' => "RubyContenfulManagementGem/#{ Contentful::Management::VERSION }" }
        end

        describe '#organization_header' do
          it 'is a hash' do
            expect(client.organization_header('MyOrganizationID')).to be_kind_of Hash
          end

          it 'returns the "X-Contentful-Organization" header' do
            expect(client.organization_header('MyOrganizationID'))
            .to eql 'X-Contentful-Organization' => 'MyOrganizationID'
          end
        end
      end

      describe '#protocol' do
        its(:protocol) { should eql 'https' }

        it 'is http when secure set to true' do
          client = Client.new('token', secure: true)
          expect(client.protocol).to eql 'https'
        end

        it 'is http when secure set to false' do
          client = Client.new('token', secure: false)
          expect(client.protocol).to eql 'http'
        end
      end

      describe '#default_locale' do
        it 'is http when secure set to true' do
          client = Client.new('token', secure: true)<commit_msg>Fix typo in spec<commit_after>require 'spec_helper'
require 'contentful/management/client'

module Contentful
  module Management
    describe Client do
      let(:token) { '<ACCESS_TOKEN>' }
      let(:client) { Client.new(token) }

      subject { client }

      its(:access_token) { should be token }

      describe 'headers' do
        describe '#authentication_header' do
          its(:authentication_header) { should be_kind_of Hash }
          its(:authentication_header) { should eql 'Authorization' => 'Bearer <ACCESS_TOKEN>' }
        end

        describe '#api_version_header' do
          its(:api_version_header) { should be_kind_of Hash }
          its(:api_version_header) { should eql 'Content-Type' => 'application/vnd.contentful.management.v1+json' }
        end

        describe '#request_headers' do
          its(:request_headers) { should be_kind_of Hash }
          its(:request_headers) { should include client.authentication_header }
          its(:request_headers) { should include client.api_version_header }
          its(:request_headers) { should include client.user_agent }
        end

        describe '#user_agent' do
          its(:user_agent) { should be_kind_of Hash }
          its(:user_agent) { should eq 'User-Agent' => "RubyContentfulManagementGem/#{ Contentful::Management::VERSION }" }
        end

        describe '#organization_header' do
          it 'is a hash' do
            expect(client.organization_header('MyOrganizationID')).to be_kind_of Hash
          end

          it 'returns the "X-Contentful-Organization" header' do
            expect(client.organization_header('MyOrganizationID'))
            .to eql 'X-Contentful-Organization' => 'MyOrganizationID'
          end
        end
      end

      describe '#protocol' do
        its(:protocol) { should eql 'https' }

        it 'is http when secure set to true' do
          client = Client.new('token', secure: true)
          expect(client.protocol).to eql 'https'
        end

        it 'is http when secure set to false' do
          client = Client.new('token', secure: false)
          expect(client.protocol).to eql 'http'
        end
      end

      describe '#default_locale' do
        it 'is http when secure set to true' do
          client = Client.new('token', secure: true)
{'fraction_non_alphanumeric': 0.09752925877763328, 'fraction_numerical': 0.00043346337234503684, 'mean_word_length': 2.480392156862745, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4764935', 'n_tokens_mistral': 1282, 'n_tokens_neox': 1250, 'n_words': 340}