diff --git a/packages/heroku-pipelines/commands/pipelines/create.js b/packages/heroku-pipelines/commands/pipelines/create.js index 49213a2ee5..cf75563607 100644 --- a/packages/heroku-pipelines/commands/pipelines/create.js +++ b/packages/heroku-pipelines/commands/pipelines/create.js @@ -62,8 +62,8 @@ module.exports = { body: {pipeline: {id: pipeline.id}, stage: stage}, headers: { 'Accept': 'application/vnd.heroku+json; version=3.pipelines' } }); // heroku.apps(app_id).pipline_couplings().create(body); - let app = yield cli.action(`Adding ${context.app} to ${pipeline.name} pipeline as ${stage}`, promise); - cli.hush(app); + let coupling = yield cli.action(`Adding ${context.app} to ${pipeline.name} pipeline as ${stage}`, promise); + cli.hush(coupling); }); }); }) diff --git a/packages/heroku-pipelines/commands/pipelines/info.js b/packages/heroku-pipelines/commands/pipelines/info.js index 80784e0e2e..6c9b51522c 100644 --- a/packages/heroku-pipelines/commands/pipelines/info.js +++ b/packages/heroku-pipelines/commands/pipelines/info.js @@ -41,14 +41,5 @@ module.exports = { } // Pass in sort order for stages cli.styledHash(stages, ["review", "development", "test", "qa", "staging", "production"]); - -// let pipeline = context.args.pipeline || "example"; -// cli.log(`=== ${pipeline}`); -// cli.log("Source type: github"); -// cli.log("Source repo: heroku/example"); -// cli.log("Staging: example-staging"); -// cli.log("Production: example"); -// cli.log(" example-admin"); -// cli.log("Flow: example-staging —> example, example-admin"); }) }; diff --git a/packages/heroku-pipelines/test/commands/pipelines/create.js b/packages/heroku-pipelines/test/commands/pipelines/create.js index 1b83b08608..e04d06f9ab 100644 --- a/packages/heroku-pipelines/test/commands/pipelines/create.js +++ b/packages/heroku-pipelines/test/commands/pipelines/create.js @@ -2,35 +2,30 @@ let cli = require('heroku-cli-util'); let nock = require('nock'); -let sinon = require('sinon'); let cmd = require('../../../commands/pipelines/create'); describe('pipelines:create', function () { beforeEach(function () { - this.cliDebug = sinon.stub(cli, 'debug'); + cli.mockConsole(); }); - afterEach(function () { - this.cliDebug.restore(); - }); - - it('displays the app info and config vars', function () { - let self = this; - let app = {name: 'myapp', web_url: 'https://myapp.herokuapp.com/'}; - let config = {FOO: 'bar'}; + it('displays the pipeline name and app stage', function () { + let self = this; + let pipeline = {name: 'example', id: '0123'}; + let pipeline_coupling = { id: '0123', stage: "production" }; nock('https://api.heroku.com') - .get('/apps/myapp') - .reply(200, app); + .post('/pipelines') + .reply(201, pipeline); nock('https://api.heroku.com') - .get('/apps/myapp/config-vars') - .reply(200, config); + .post('/apps/example/pipeline-couplings') + .reply(201, pipeline_coupling); - return cmd.run({app: 'myapp'}) + return cmd.run({app: 'example', args: {name: 'example'}, flags: {stage: 'production'}}) .then(function () { - self.cliDebug.should.have.been.calledWith(app); - self.cliDebug.should.have.been.calledWith(config); + cli.stdout.should.contain('example'); + cli.stdout.should.contain('production'); }); }); }); diff --git a/packages/heroku-pipelines/test/commands/pipelines/info.js b/packages/heroku-pipelines/test/commands/pipelines/info.js index 2b830f0e2d..3b95595cfd 100644 --- a/packages/heroku-pipelines/test/commands/pipelines/info.js +++ b/packages/heroku-pipelines/test/commands/pipelines/info.js @@ -1,35 +1,31 @@ 'use strict'; -let cli = require('heroku-cli-util'); -let cmd = require('../../../commands/pipelines/info'); +let cli = require('heroku-cli-util'); +let nock = require('nock'); +let cmd = require('../../../commands/pipelines/info'); describe('pipelines:info', function () { beforeEach(function () { cli.mockConsole(); }); - it('displays the app info and config vars', function () { + it('displays the pipeline info and apps', function () { let self = this; - let pipeline = {name: 'example', source_type: 'github', source_repo: 'heroku/example'}; - let apps = [{name: 'example-staging', stage: 'staging'}, {name: 'example', stage: 'production'}, {name: 'example-admin', stage: 'production'}]; + let pipeline = {name: 'example', id: '0123'}; + let apps = [{name: 'example-staging', coupling: {stage: 'staging'}, pipeline: pipeline}, {name: 'example', coupling: {stage: 'production'}, pipeline: pipeline}, {name: 'example-admin', coupling: {stage: 'production'}, pipeline: pipeline}]; nock('https://api.heroku.com') .get('/pipelines/example') .reply(200, pipeline); nock('https://api.heroku.com') - .get('/pipelines/example/apps') + .get('/pipelines/0123/apps') .reply(200, apps); - return cmd.run({app: 'example'}) + return cmd.run({args: {pipeline: 'example'}}) .then(function () { - self.cliDebug.should.have.been.calledWith(pipeline); - self.cliDebug.should.have.been.calledWith(apps); + cli.stdout.should.contain('Staging:'); + cli.stdout.should.contain('example-staging'); }); }); - - it('says "example" when the user is "example"', function () { - cmd.run({args: {pipeline: 'example'}}); - cli.stdout.should.containe('example'); - }); });