Sha256: 35d17a21d85b0f446c5246eead2db56c8bcec6c8627e3f1638b574b28011b1ed

Contents?: true

Size: 1.37 KB

Versions: 148

Compression:

Stored size: 1.37 KB

Contents

describe KnapsackPro::Crypto::BranchEncryptor do
  let(:branch) { 'feature-branch' }
  let(:encryptor) { described_class.new(branch) }

  describe '.call' do
    subject { described_class.call(branch) }

    before do
      expect(KnapsackPro::Config::Env).to receive(:branch_encrypted?).and_return(branch_encrypted?)
    end

    context 'when branch encrypted flag enabled' do
      let(:branch_encrypted?) { true }
      let(:encryptor) { instance_double(described_class) }

      it do
        expect(described_class).to receive(:new).with(branch).and_return(encryptor)
        result = double
        expect(encryptor).to receive(:call).and_return(result)

        expect(subject).to eq result
      end
    end

    context 'when test files encrypted flag disabled' do
      let(:branch_encrypted?) { false }

      it { should eq branch }
    end
  end

  describe '#call' do
    subject { encryptor.call }

    context 'when encryptable branch name' do
      let(:branch) { 'feature-branch' }

      before do
        expect(KnapsackPro::Config::Env).to receive(:salt).at_least(1).and_return('123')
      end

      it { should eq '49e5bb1' }
    end

    described_class::NON_ENCRYPTABLE_BRANCHES.each do |branch_name|
      context "when non encryptable branch name: #{branch_name}" do
        let(:branch) { branch_name }

        it { should eq branch_name }
      end
    end
  end
end

Version data entries

148 entries across 148 versions & 1 rubygems

Version Path
knapsack_pro-2.18.1 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.18.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.17.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.16.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.15.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.14.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.13.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.12.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.11.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.10.1 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.10.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.9.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.8.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.7.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.6.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.5.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.4.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.3.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.2.1 spec/knapsack_pro/crypto/branch_encryptor_spec.rb
knapsack_pro-2.2.0 spec/knapsack_pro/crypto/branch_encryptor_spec.rb