Sha256: c30668745b602a89ee88a30ec286edc45f7d92c042d7eb10cfc0f52feeb7ff91

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe Hawkei::Config do
  subject(:config) { Hawkei::Config.new(params) }

  describe  '#initialize' do
    let(:params) {{ api_key: 'acc_xx', space_name: 'Hawkei', environment_name: 'test' }}

    it { expect(config.valid!).to be_truthy }

    %i[api_key environment_name api_host api_version].each do |field|
      context "validate #{field}" do
        let(:params) {
          {
            api_key: 'acc_xx',
            space_name: 'Hawkei',
            environment_name: 'test',
            api_host: 'host',
            api_version: 'v1',
          }.merge(field => '')
        }

        it { expect { config.valid! }.to raise_error(Hawkei::ConfigurationError, "#{field} can't be blank") }
      end
    end

    context 'format obfuscated_fields' do
      let(:params) {{ api_key: 'acc_xx', space_name: 'Hawkei', environment_name: 'test', obfuscated_fields: %i[another_password password_confirmation] }}

      before { config.valid! }

      it { expect(config.obfuscated_fields).to match_array(%w[another_password password_confirmation password access_token api_key authenticity_token ccv credit_card_number cvv secret secret_token token]) }
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hawkei-1.1.0 spec/lib/hawkei/config_spec.rb
hawkei-1.0.0 spec/lib/hawkei/config_spec.rb