Skip to content
This repository has been archived by the owner on Dec 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #9 from mizzy/set-build-output-and-status-before-a…
Browse files Browse the repository at this point in the history
…fter_executes

Set build output and status before after executes
  • Loading branch information
r7kamura committed Aug 26, 2013
2 parents 55111f2 + f6a4d95 commit de8e092
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 4 additions & 1 deletion app/models/job.rb
Expand Up @@ -114,7 +114,10 @@ def execute_without_before_executes
end

def execute_script
Altria::Executer.execute(script)
result = Altria::Executer.execute(script)
return unless result
current_build.update_attributes!(output: result[:output], status: result[:status])
result
end

def execute_before_enqueues
Expand Down
2 changes: 0 additions & 2 deletions spec/factories/build.rb
Expand Up @@ -3,7 +3,5 @@
FactoryGirl.define do
factory(:build) do
job { FactoryGirl.create(:job) }
started_at { Time.now }
finished_at { Time.now }
end
end
4 changes: 2 additions & 2 deletions spec/requests/builds_spec.rb
Expand Up @@ -14,7 +14,7 @@
end

let(:build) do
FactoryGirl.create(:build, job: job)
FactoryGirl.create(:build, job: job, finished_at: Time.now)
end

describe "GET /jobs/:job_id/builds" do
Expand All @@ -31,7 +31,7 @@
context "with page" do
before do
params[:page] = 2
10.times { FactoryGirl.create(:build, job: job) }
10.times { FactoryGirl.create(:build, job: job, finished_at: Time.now) }
end

it "paginates builds" do
Expand Down

0 comments on commit de8e092

Please sign in to comment.