Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding delete_build_step and relevant spec #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/teamcity/client/build_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,17 @@ def create_build_step(buildtype_id, options = {}, &block)
end
end

# Delete Build Step
#
# @param buildtype_id [String] :buildtype_id to create the step under
# @param step_id [String] the id of the build step
# @return [nil]
def delete_build_step(buildtype_id, step_id)
path = "buildTypes/#{buildtype_id}/steps/#{step_id}"
delete(path, :accept => :text, :content_type => :text)
nil
end

# Create Build Trigger
#
# @param buildtype_id [String] :buildtype_id to create the trigger under
Expand Down
14 changes: 14 additions & 0 deletions spec/teamcity/client/buildtypes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,20 @@
end
end

describe '.delete_build_step' do
it 'should delete a build step given a build type id and build step id' do
step_to_delete = 'Unit Test Step to Delete'
@tc.create_build_step(@buildtype_id, step_to_delete, type: 'Maven') do |properties|
properties['goals'] = 'verify'
properties['mavenSelection'] = 'mavenSelection:default'
properties['pomLocation'] = 'pom.xml'
end
s = @tc.buildtype_steps(id: @buildtype_id).detect { | step | step['name'].eql? step_to_delete }
@tc.delete_build_step(@buildtype_id, s['id']).should be_nil
@tc.buildtype_steps(id: @buildtype_id).detect { | step | step['name'].eql? step_to_delete }.should be_nil
end
end

describe '.create_build_trigger' do
it 'should create a build trigger for a given build type' do
response = @tc.create_build_trigger(@buildtype_id, type: 'vcsTrigger') do |properties|
Expand Down