Save package_version during success build_list publish. Add specs. Refs #103
This commit is contained in:
parent
80d6d105f6
commit
712ca8d95a
|
@ -80,7 +80,12 @@ class BuildListsController < ApplicationController
|
|||
end
|
||||
|
||||
def publish_build
|
||||
@build_list.status = (params[:status].to_i == 0 ? BuildList::BUILD_PUBLISHED : BuildList::FAILED_PUBLISH)
|
||||
if params[:status].to_i == 0 # ok
|
||||
@build_list.status = BuildList::BUILD_PUBLISHED
|
||||
@build_list.package_version = "#{params[:version]}-#{params[:release]}"
|
||||
else
|
||||
@build_list.status = BuildList::FAILED_PUBLISH
|
||||
end
|
||||
@build_list.notified_at = Time.current
|
||||
@build_list.save
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class AddPackageVersionToBuildLists < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :build_lists, :package_version, :string
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :build_lists, :package_version
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20111228182425) do
|
||||
ActiveRecord::Schema.define(:version => 20120113151305) do
|
||||
|
||||
create_table "arches", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
|
@ -72,6 +72,7 @@ ActiveRecord::Schema.define(:version => 20111228182425) do
|
|||
t.text "include_repos"
|
||||
t.integer "user_id"
|
||||
t.boolean "auto_publish", :default => true
|
||||
t.string "package_version"
|
||||
end
|
||||
|
||||
add_index "build_lists", ["arch_id"], :name => "index_build_lists_on_arch_id"
|
||||
|
|
|
@ -300,13 +300,15 @@ describe BuildListsController do
|
|||
|
||||
describe 'publish_build' do
|
||||
def do_get(status)
|
||||
get :publish_build, :id => build_list.bs_id, :status => status
|
||||
get :publish_build, :id => build_list.bs_id, :status => status, :version => '4.7.5.3', :release => '1'
|
||||
build_list.reload
|
||||
end
|
||||
|
||||
it { do_get(BuildServer::SUCCESS); response.should be_ok }
|
||||
it { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :status).to(BuildList::BUILD_PUBLISHED) }
|
||||
it { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :package_version).to('4.7.5.3-1') }
|
||||
it { lambda{ do_get(BuildServer::ERROR) }.should change(build_list, :status).to(BuildList::FAILED_PUBLISH) }
|
||||
it { lambda{ do_get(BuildServer::ERROR) }.should_not change(build_list, :package_version) }
|
||||
it { lambda{ do_get(BuildServer::ERROR) }.should change(build_list, :notified_at) }
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue