triggers_spec.rb #2

  • //
  • guest/
  • doug_scheirer/
  • helix-web-services/
  • main/
  • source/
  • helix_web_services/
  • spec/
  • helix_versioning_engine/
  • triggers_spec.rb
  • View
  • Commits
  • Open Download .zip Download (1 KB)
# Copyright (c) 2015 Perforce Software, Inc.  All rights reserved.

require_relative '../test_config'

require 'helix_versioning_engine'

RSpec.describe 'HelixVersioningEngine triggers' do
  include Rack::Test::Methods

  def app
    HELIX_WEB_SERVICES_APP
  end

  entry = 'cscheck change-submit //depot/... "cmd %changelist%"'

  it 'should add a triggers entry' do
    authorize 'super', ticket_for_super
    get('/p4/v78/triggers')

    expect(last_response.status).to eq(200)

    obj = JSON.parse(last_response.body)
    obj['Triggers'] = [] unless obj.key?('Triggers')
    obj['Triggers'] << entry

    put('/p4/v78/triggers', obj)

    expect(last_response.status).to eq(200)

    get('/p4/v78/triggers')

    expect(last_response.status).to eq(200)

    updated = JSON.parse(last_response.body)

    expect(updated['Triggers']).to include(entry)
  end

  it 'should remove the triggers entry' do
    authorize 'super', ticket_for_super
    get('/p4/v78/triggers')

    expect(last_response.status).to eq(200)

    obj = JSON.parse(last_response.body)
    obj['Triggers'].delete(entry)

    put('/p4/v78/triggers', obj)

    expect(last_response.status).to eq(200)

    get('/p4/v78/triggers')

    expect(last_response.status).to eq(200)

    updated = JSON.parse(last_response.body)
    updated['Triggers'] = [] unless updated.key?('Triggers')

    expect(updated['Triggers']).to_not include(entry)
  end
end
# Change User Description Committed
#2 16114 Doug Scheirer Merge from main
#1 15688 Doug Scheirer Populate -o //guest/perforce_software/helix-web-services/...
//guest/doug_scheirer/helix-web-services/....
//guest/perforce_software/helix-web-services/main/source/helix_web_services/spec/helix_versioning_engine/triggers_spec.rb
#1 15622 tjuricek Move source code to 'source/' subdirectory of branch.

build/ will remain where it is.
//guest/perforce_software/helix-web-services/main/helix_web_services/spec/helix_versioning_engine/triggers_spec.rb
#2 15240 tjuricek Set api level via request path on all Helix Versioning Engine methods.

This will allow migration of applications to different P4D versions. Our internal methods (like project API) should attempt to handle backward compatibility similarly.

P4WEBAPI-118
#1 15228 tjuricek Revise triggers implementation, tests, and documentation.