Sha256: e37819d9a656cafd81b37f2e7140357aaec25e72f12151804d329324a82785b0

Contents?: true

Size: 1.72 KB

Versions: 5

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'

describe AdminModule::CLI do

  let(:cli) do
              AdminModule.configure do |config|
                config.credentials = { :dev => ['admin', 'Password1*'] }
              end
              AdminModule::CLI.new
            end

      after(:each) do
        cli.quit
      end

  describe "#get_lock" do
    context "invalid lock name" do
      it "will raise exception" do
        expect { cli.get_lock('invalid') }.to raise_exception(ArgumentError)
      end
    end # context "invalid lock name"


    context "valid lock name" do

      let(:expected_dod_lock)  do
                                    { name: 'DODLock',
                                      description: '',
                                      is_program_lock: false,
                                      parameters: [],
                                      dts: [
                                        'Delinquency Status',
                                        'Has Escrow Account'
                                        ]
                                    }
                                  end


      it "will return lock configuration data" do
        expect( cli.get_lock('DODLock') ).to eq expected_dod_lock
      end
    end # context "valid lock name"
  end # describe "#get_lock"

  describe "#export_locks" do
    context "with filename" do

      let(:target_file)   { 'tmp/spec/admin_module/locks.yml' }

      before(:each) do
        FileUtils.rm_rf target_file
      end


      it "writes multiple locks to a file" do
        cli.export_locks(target_file)
        locks = read_yaml_data_file(target_file)
        expect(locks.size).to eq 20
      end
    end # context
  end # describe "#export_locks"
end # describe AdminModule

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
admin_module-0.1.8 old_spec/lib/admin_module/cli_export_locks_spec.rb
admin_module-0.1.7 old_spec/lib/admin_module/cli_export_locks_spec.rb
admin_module-0.1.6 old_spec/lib/admin_module/cli_export_locks_spec.rb
admin_module-0.1.5 old_spec/lib/admin_module/cli_export_locks_spec.rb
admin_module-0.1.4 old_spec/lib/admin_module/cli_export_locks_spec.rb