Skip to content

Commit

Permalink
fixed an issue with the build not updating due to extra from the work…
Browse files Browse the repository at this point in the history
…er being sent
  • Loading branch information
joshk committed Aug 6, 2011
1 parent 51d8cb1 commit f22a63e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/builds_controller.rb
Expand Up @@ -32,7 +32,7 @@ def create

def update
build = Build.find(params[:id])
build.update_attributes!(params[:build])
build.update_attributes!(params[:build].except(:queue))

if build.was_started?
trigger('build:started', build, 'msg_id' => params[:msg_id])
Expand Down
35 changes: 35 additions & 0 deletions test/integration/builds_controller_test.rb
Expand Up @@ -118,6 +118,41 @@ def setup
# TODO
end

test "PUT to /builds/:id with unrecognized build attribute queue is removed from build before updating attributes" do
payload = WORKER_PAYLOADS[:started].merge('msg_id' => 0)
payload['build'] = payload['build'].merge('queue' => 'builds')

authenticated_put(build_path(build), payload)

build.reload

assert_build_started

assert_equal ['build:started', {
'repository' => {
'id' => build.repository.id,
:slug => 'svenfuchs/minimal',
'last_build_id' => build.id,
'last_build_number' => '1',
'last_build_status' => nil,
'last_build_started_at' => build.started_at,
'last_build_finished_at' => nil
},
'build' => {
'id' => build.id,
'repository_id' => build.repository.id,
'number' => '1',
'commit' => '62aae5f70ceee39123ef',
'branch' => 'master',
'message' => 'the commit message',
'committer_name' => 'Sven Fuchs',
'committer_email' => 'svenfuchs@artweb-design.de',
'started_at' => build.started_at,
},
'msg_id' => '0'
}], channel.messages.first
end

test 'walkthrough from Github ping to finished build' do
ping_from_github!
assert_build_job
Expand Down

0 comments on commit f22a63e

Please sign in to comment.