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.5.4 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.5.4.rc1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.5.3 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.5.2 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.5.1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.5.0 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.5.0.rc1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.5.0.pre5 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.5.0.pre4 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.5.0.pre3 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.5.0.pre2 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.5.0.pre1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.3 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.3.rc1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.2 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.2.rc1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.2.pre1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.1.rc1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
kontena-cli-1.4.1.pre1 spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb