Sha256: 04454ae69a37ccb6bcfe18937d53cf927b93cf03f02099afed46330b1f5316bf

Contents?: true

Size: 778 Bytes

Versions: 1

Compression:

Stored size: 778 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'fileutils'
require 'digest'

describe Travis::CLI::EncryptFile do
  CMD_TARGET = 'README.md'

  before do

    ENV['TRAVIS_TOKEN'] = 'token'
    Digest.stub(:hexencode).and_return 'randomhex' # to avoid relying on Dir.pwd value for hex
  end

  after do
    FileUtils.rm_f "#{CMD_TARGET}.enc"
  end

  example "travis encrypt-file #{CMD_TARGET}" do
    run_cli('encrypt-file', CMD_TARGET).should be_success
    File.exist?("#{CMD_TARGET}.enc").should be true
  end

  example "travis encrypt-file #{CMD_TARGET} -a" do
    run_cli('encrypt-file', CMD_TARGET, '-a') { |i| i.puts 'n' }.should be_success
    stdout.should match(/Overwrite the config file/)
    File.exist?("#{CMD_TARGET}.enc").should be true
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
travis-1.14.0 spec/cli/encrypt_file_spec.rb