Sha256: 88722e48b71ebc03f80958f1f340ca8defc2865d59bbd908659c87606f291f13

Contents?: true

Size: 1.63 KB

Versions: 21

Compression:

Stored size: 1.63 KB

Contents

require "rubygems"
require "bundler/setup"
require 'tempfile'
require 'ostruct'

require "simplecov"
SimpleCov.start
  
def post_response(id, attributes = {})
  attributes[:id] = id
  
  OpenStruct.new({
    headers: { location: [ collection_url, id ].join('/') }, 
    body: attributes.to_json
  })
end

# stub parameters to be used in resource/asset tests
KIND="asset_kind"
ID="unique_id" 
ROLE='<role>'
MEMBER='<member>'
PRIVILEGE='<privilege>'
OWNER='<owner/userid>'
ACCOUNT='<core_account>'

require 'conjur/command/rspec/helpers'

ENV['CONJURRC'] = '/dev/null'

require 'conjur/cli'
require 'conjur/api'
require 'conjur/complete'

shared_context "fresh config" do
  before {
    ENV.delete_if do |k,v|
      k =~ /^CONJUR_/
    end
    
    @configuration = Conjur.configuration
    Conjur.configuration = Conjur::Configuration.new
  }
  after {
    Conjur::Config.clear
    Conjur.configuration = @configuration
  }
end

RSpec::Core::DSL.change_global_dsl do
  def describe_conjurize *argv, &block
    describe *argv do
      let(:command) { Conjur::Conjurize }
      let(:invoke) do
        command.go!
      end
      before {
        require 'methadone'
        
        option_parser = OptionParser.new
        expect(option_parser).to receive(:parse!).with(no_args) do |*args|
          option_parser.parse! argv
        end
        allow(option_parser).to receive(:parse!).and_call_original
        option_parser_proxy = nil
        expect(Conjur::Conjurize).to receive(:opts) do |*args|
          option_parser_proxy ||= Methadone::OptionParserProxy.new(option_parser, command.options)
        end
      }
      instance_eval &block
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
conjur-cli-5.6.4 spec/spec_helper.rb
conjur-cli-5.6.3 spec/spec_helper.rb
conjur-cli-5.5.0 spec/spec_helper.rb
conjur-cli-5.4.0 spec/spec_helper.rb
conjur-cli-5.3.0 spec/spec_helper.rb
conjur-cli-5.2.5 spec/spec_helper.rb
conjur-cli-5.2.4 spec/spec_helper.rb
conjur-cli-5.2.3 spec/spec_helper.rb
conjur-cli-5.2.1 spec/spec_helper.rb
conjur-cli-5.2.0 spec/spec_helper.rb
conjur-cli-5.1.2 spec/spec_helper.rb
conjur-cli-5.1.1 spec/spec_helper.rb
conjur-cli-5.1.0 spec/spec_helper.rb
conjur-cli-4.30.1 spec/spec_helper.rb
conjur-cli-4.30.0 spec/spec_helper.rb
conjur-cli-4.29.0 spec/spec_helper.rb
conjur-cli-4.28.2 spec/spec_helper.rb
conjur-cli-4.28.1 spec/spec_helper.rb
conjur-cli-4.28.0 spec/spec_helper.rb
conjur-cli-4.27.0 spec/spec_helper.rb