@@ -144,6 +144,7 @@ describe('Github - /actions/github', function () {
144144 ctx . originalBuildsOnPushSetting = process . env . ENABLE_GITHUB_HOOKS ;
145145 ctx . originaUpdateInstance = Runnable . prototype . updateInstance ;
146146 ctx . originaCreateBuild = Runnable . prototype . createBuild ;
147+ ctx . originaBuildBuild = Runnable . prototype . buildBuild ;
147148 ctx . originalWaitForInstanceDeployed = Runnable . prototype . waitForInstanceDeployed ;
148149 ctx . originalBuildErrored = PullRequest . prototype . buildErrored ;
149150 ctx . originalDeploymentErrored = PullRequest . prototype . deploymentErrored ;
@@ -157,6 +158,7 @@ describe('Github - /actions/github', function () {
157158 process . env . ENABLE_GITHUB_HOOKS = ctx . originalBuildsOnPushSetting ;
158159 Runnable . prototype . updateInstance = ctx . originaUpdateInstance ;
159160 Runnable . prototype . createBuild = ctx . originaCreateBuild ;
161+ Runnable . prototype . buildBuild = ctx . originaBuildBuild ;
160162 Runnable . prototype . waitForInstanceDeployed = ctx . originalWaitForInstanceDeployed ;
161163 PullRequest . prototype . buildErrored = ctx . originalBuildErrored ;
162164 PullRequest . prototype . deploymentErrored = ctx . originalDeploymentErrored ;
@@ -180,6 +182,36 @@ describe('Github - /actions/github', function () {
180182 } ) ;
181183
182184
185+ it ( 'should set build status to error if error happened build create' , { timeout : 6000 } ,
186+ function ( done ) {
187+
188+
189+ Runnable . prototype . createBuild = function ( opts , cb ) {
190+ cb ( Boom . notFound ( 'Build create failed' ) ) ;
191+ } ;
192+
193+ PullRequest . prototype . buildErrored = function ( pullRequest , targetUrl , cb ) {
194+ expect ( pullRequest ) . to . exist ( ) ;
195+ expect ( targetUrl ) . to . include ( 'https://runnable.io/' ) ;
196+ cb ( ) ;
197+ done ( ) ;
198+ } ;
199+
200+ var acv = ctx . contextVersion . attrs . appCodeVersions [ 0 ] ;
201+ var data = {
202+ branch : 'master' ,
203+ repo : acv . repo ,
204+ ownerId : 2
205+ } ;
206+ var options = hooks ( data ) . pull_request_sync ;
207+ require ( './fixtures/mocks/github/users-username' ) ( 101 , 'podviaznikov' ) ;
208+ require ( './fixtures/mocks/docker/container-id-attach' ) ( ) ;
209+ request . post ( options , function ( err , res , instancesIds ) {
210+ if ( err ) { return done ( err ) ; }
211+ expect ( instancesIds . length ) . to . equal ( 0 ) ;
212+ } ) ;
213+ } ) ;
214+
183215
184216 it ( 'should set deployment status to error if error happened during instance update' , { timeout : 6000 } ,
185217 function ( done ) {
0 commit comments