Permalink
Browse files

fixed an issue with the build not updating due to extra from the work…

…er being sent
  • Loading branch information...
1 parent 51d8cb1 commit f22a63eb2409c014a5c26772b596f448fb700eff @joshk joshk committed Aug 6, 2011
Showing with 36 additions and 1 deletion.
  1. +1 −1 app/controllers/builds_controller.rb
  2. +35 −0 test/integration/builds_controller_test.rb
@@ -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])
@@ -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

0 comments on commit f22a63e

Please sign in to comment.