# Copyright (c) 2014-2015 Perforce Software, Inc. All rights reserved. require 'rspec' require 'helix_web_services_client' require_relative './test_config' RSpec.describe 'HelixWebServicesClient depots' do randstr = (0...8).map { (65 + rand(26)).chr }.join depot_id = "test_#{randstr}" new_depot = { 'Depot' => depot_id, 'Description' => "Test Depot #{randstr}", 'Type' => 'local', 'Map' => "#{depot_id}/..." } context '#create_depot' do it 'should create a new depot - and return it via #depots' do client_as_super do |c| c.create_depot(new_depot) depots = c.depots expect(depots.map(&:name_or_depot)).to include(depot_id) end end end context '#depot' do it 'should load a single depot created via #create_depot' do client_as_jdoe do |c| new_depot = c.depot(depot_id) expect(new_depot.description).to include(new_depot['Description']) end end end context '#update_depot' do it "'should be able to update the depot description'" do client_as_super do |c| new_depot = c.depot(depot_id) new_depot.description = "Updated #{randstr}" c.update_depot(new_depot) loaded = c.depot(depot_id) expect(loaded.description).to include("Updated #{randstr}") end end end context '#delete_depot' do it "'should be able to delete a depot created via #create_depot'" do client_as_super do |c| c.delete_depot(depot_id) depots = c.depots expect(depots.map(&:depot)).to_not include(depot_id) end end end end