Sha256: 7865c1d6a12173b952724183facd114138332136ff7c6673a7f8fac306979984

Contents?: true

Size: 861 Bytes

Versions: 81

Compression:

Stored size: 861 Bytes

Contents

require 'opto'
require 'kontena_cli'
require 'kontena/cli/stacks/yaml/opto'

describe Kontena::Cli::Stacks::YAML::Prompt do

  describe 'echoing' do
    let(:option_without_echo) { Opto::Option.new(type: 'string', name: 'foo', from: 'prompt', echo: false) }
    let(:option_with_echo) { Opto::Option.new(type: 'string', name: 'foo', from: 'prompt') }
    let(:prompt) { double(:prompt) }

    before(:each) do
      allow(Kontena).to receive(:prompt).and_return(prompt)
    end

    it 'turns echo off when variable has "echo: false"' do
      expect(prompt).to receive(:ask).with(/Enter/, hash_including(echo: false))
      option_without_echo.value
    end

    it 'keeps echo on when variable does not have "echo: false"' do
      expect(prompt).to receive(:ask).with(/Enter/, hash_not_including(echo: false))
      option_with_echo.value
    end
  end
end

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
kontena-cli-1.3.4.rc1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.3 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.3.rc1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.2 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.2.rc2 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.2.rc1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.1.rc2 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.1.rc1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.0 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.0.rc4 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.0.rc3 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.0.rc2 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.0.rc1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.0.pre2 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.0.pre1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.2.2 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.2.2.rc2 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.2.2.rc1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.2.1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb