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.5 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.5.rc1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.rc2 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.rc1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.pre14 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.pre13 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.pre12 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.pre11 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.pre10 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.pre9 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.pre8 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.pre7 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.pre6 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.pre5 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.pre4 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.pre3 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.pre2 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.0.pre1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.3.4 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb