<commit_before>require 'rspectacular'
require 'chamber/commands/show'

# rubocop:disable Metrics/LineLength
module    Chamber
module    Commands
describe  Show do
  let(:rootpath) { ::File.expand_path('./spec/fixtures') }
  let(:options)  do
    {  basepath:   rootpath,
       rootpath:   rootpath,
       namespaces: 'test' }
  end

  it 'can return values formatted as environment variables' do
    expect(Show.call(options.merge(as_env: true))).to eql(
<<-HEREDOC.chomp
ANOTHER_LEVEL_LEVEL_THREE_A_SCALAR="hello"
ANOTHER_LEVEL_LEVEL_THREE_AN_ARRAY="["item 1", "item 2", "item 3"]"
ANOTHER_LEVEL_SETTING_ONE="1"
ANOTHER_LEVEL_SETTING_TWO="2"
MY_BOOLEAN="false"
MY_DYNAMIC_SETTING="2"
MY_SECURE_SETTINGS="<KEY>
MY_SETTING="my_value"
HEREDOC
    )
  end

  it 'can return values filtered by whether or not they are secure' do
    expect(Show.call(options.merge(as_env: true, only_secure: true))).to eql(
<<-HEREDOC.chomp
MY_SECURE_SETTINGS="<KEY>
HEREDOC
    )<commit_msg>Style: Make whitespace changes<commit_after>require 'rspectacular'
require 'chamber/commands/show'

# rubocop:disable Metrics/LineLength
module    Chamber
module    Commands
describe  Show do
  let(:rootpath) { ::File.expand_path('./spec/fixtures') }
  let(:options) do
    {
      basepath:       rootpath,
      rootpath:       rootpath,
      namespaces:     'test',
    }
  end

  it 'can return values formatted as environment variables' do
    expect(Show.call(options.merge(as_env: true))).to eql(
<<-HEREDOC.chomp
ANOTHER_LEVEL_LEVEL_THREE_A_SCALAR="hello"
ANOTHER_LEVEL_LEVEL_THREE_AN_ARRAY="["item 1", "item 2", "item 3"]"
ANOTHER_LEVEL_SETTING_ONE="1"
ANOTHER_LEVEL_SETTING_TWO="2"
MY_BOOLEAN="false"
MY_DYNAMIC_SETTING="2"
MY_SECURE_SETTINGS="<KEY>
MY_SETTING="my_value"
HEREDOC
    )
  end

  it 'can return values filtered by whether or not they are secure' do
    expect(Show.call(options.merge(as_env: true, only_secure: true))).to eql(
<<-HEREDOC.chomp
MY_SECURE_SETTINGS="<KEY>
HEREDOC
    )
{'fraction_non_alphanumeric': 0.11806256306760847, 'fraction_numerical': 0.006054490413723511, 'mean_word_length': 4.866863905325443, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 7, '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': '4902527', 'n_tokens_mistral': 741, 'n_tokens_neox': 727, 'n_words': 149}