You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by lo...@apache.org on 2014/08/21 20:23:09 UTC
[08/15] git commit: renamed cli create spec more sensibly
renamed cli create spec more sensibly
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/4f45141f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/4f45141f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/4f45141f
Branch: refs/heads/master
Commit: 4f45141f6e23c483be66c16a1bfb20824c8359bd
Parents: 64ac2fb
Author: Lorin Beer <lo...@gmail.com>
Authored: Fri Jun 13 15:33:02 2014 -0700
Committer: Lorin Beer <lo...@gmail.com>
Committed: Wed Aug 20 11:20:09 2014 -0700
----------------------------------------------------------------------
spec/cli.create.spec.js | 112 -------------------------------------------
spec/create.spec.js | 112 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 112 insertions(+), 112 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/4f45141f/spec/cli.create.spec.js
----------------------------------------------------------------------
diff --git a/spec/cli.create.spec.js b/spec/cli.create.spec.js
deleted file mode 100644
index 9b6e8de..0000000
--- a/spec/cli.create.spec.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-*/
-
-var cli = require("../src/cli"),
- Q = require('q'),
- cordova_lib = require('cordova-lib'),
- plugman = cordova_lib.plugman,
- cordova = cordova_lib.cordova;
-
-describe("cordova cli", function () {
- beforeEach(function () {
- // Event registration is currently process-global. Since all jasmine
- // tests in a directory run in a single process (and in parallel),
- // logging events registered as a result of the "--verbose" flag in
- // CLI testing below would cause lots of logging messages printed out by other specs.
- spyOn(cordova, "on");
- spyOn(plugman, "on");
- });
-
- describe("options", function () {
- describe("version", function () {
- var version = require("../package").version;
- beforeEach(function () {
- spyOn(console, "log");
- });
-
- it("will spit out the version with -v", function () {
- cli(["node", "cordova", "-v"]);
- expect(console.log).toHaveBeenCalledWith(version);
- });
-
- it("will spit out the version with --version", function () {
- cli(["node", "cordova", "--version"]);
- expect(console.log).toHaveBeenCalledWith(version);
- });
-
- it("will spit out the version with -v anywher", function () {
- cli(["node", "cordova", "one", "-v", "three"]);
- expect(console.log).toHaveBeenCalledWith(version);
- });
- });
- });
-
- describe("project commands other than plugin and platform", function () {
- beforeEach(function () {
- spyOn(cordova.raw, "build").andReturn(Q());
- });
-
- it("will call command with all arguments passed through", function () {
- cli(["node", "cordova", "build", "blackberry10", "--", "-k", "abcd1234"]);
- expect(cordova.raw.build).toHaveBeenCalledWith({verbose: false, silent: false, platforms: ["blackberry10"], options: ["-k", "abcd1234"]});
- });
-
- it("will consume the first instance of -d", function () {
- cli(["node", "cordova", "-d", "build", "blackberry10", "--", "-k", "abcd1234", "-d"]);
- expect(cordova.raw.build).toHaveBeenCalledWith({verbose: true, silent: false, platforms: ["blackberry10"], options: ["-k", "abcd1234", "-d"]});
- });
-
- it("will consume the first instance of --verbose", function () {
- cli(["node", "cordova", "--verbose", "build", "blackberry10", "--", "-k", "abcd1234", "--verbose"]);
- expect(cordova.raw.build).toHaveBeenCalledWith({verbose: true, silent: false, platforms: ["blackberry10"], options: ["-k", "abcd1234", "--verbose"]});
- });
-
- it("will consume the first instance of either --verbose of -d", function () {
- cli(["node", "cordova", "--verbose", "build", "blackberry10", "--", "-k", "abcd1234", "-d"]);
- expect(cordova.raw.build).toHaveBeenCalledWith({verbose: true, silent: false, platforms: ["blackberry10"], options: ["-k", "abcd1234", "-d"]});
- });
-
- it("will consume the first instance of either --verbose of -d", function () {
- cli(["node", "cordova", "-d", "build", "blackberry10", "--", "-k", "abcd1234", "--verbose"]);
- expect(cordova.raw.build).toHaveBeenCalledWith({verbose: true, silent: false, platforms: ["blackberry10"], options: ["-k", "abcd1234", "--verbose"]});
- });
-
- it("will consume the first instance of --silent", function () {
- cli(["node", "cordova", "--silent", "build", "blackberry10", "--", "-k", "abcd1234", "--silent"]);
- expect(cordova.raw.build).toHaveBeenCalledWith({verbose: false, silent: true, platforms: ["blackberry10"], options: ["-k", "abcd1234", "--silent"]});
- });
- });
-
- describe("plugin", function () {
- beforeEach(function () {
- spyOn(cordova.raw, "plugin").andReturn(Q());
- });
-
- it("will pass variables", function () {
- cli(["node", "cordova", "plugin", "add", "facebook", "--variable", "FOO=foo"]);
- expect(cordova.raw.plugin).toHaveBeenCalledWith(
- "add",
- ["facebook"],
- jasmine.any(Object)
- );
- var opts = cordova.raw.plugin.calls[0].args[2];
- expect(opts.cli_variables.FOO).toBe('foo');
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/4f45141f/spec/create.spec.js
----------------------------------------------------------------------
diff --git a/spec/create.spec.js b/spec/create.spec.js
new file mode 100644
index 0000000..9b6e8de
--- /dev/null
+++ b/spec/create.spec.js
@@ -0,0 +1,112 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+var cli = require("../src/cli"),
+ Q = require('q'),
+ cordova_lib = require('cordova-lib'),
+ plugman = cordova_lib.plugman,
+ cordova = cordova_lib.cordova;
+
+describe("cordova cli", function () {
+ beforeEach(function () {
+ // Event registration is currently process-global. Since all jasmine
+ // tests in a directory run in a single process (and in parallel),
+ // logging events registered as a result of the "--verbose" flag in
+ // CLI testing below would cause lots of logging messages printed out by other specs.
+ spyOn(cordova, "on");
+ spyOn(plugman, "on");
+ });
+
+ describe("options", function () {
+ describe("version", function () {
+ var version = require("../package").version;
+ beforeEach(function () {
+ spyOn(console, "log");
+ });
+
+ it("will spit out the version with -v", function () {
+ cli(["node", "cordova", "-v"]);
+ expect(console.log).toHaveBeenCalledWith(version);
+ });
+
+ it("will spit out the version with --version", function () {
+ cli(["node", "cordova", "--version"]);
+ expect(console.log).toHaveBeenCalledWith(version);
+ });
+
+ it("will spit out the version with -v anywher", function () {
+ cli(["node", "cordova", "one", "-v", "three"]);
+ expect(console.log).toHaveBeenCalledWith(version);
+ });
+ });
+ });
+
+ describe("project commands other than plugin and platform", function () {
+ beforeEach(function () {
+ spyOn(cordova.raw, "build").andReturn(Q());
+ });
+
+ it("will call command with all arguments passed through", function () {
+ cli(["node", "cordova", "build", "blackberry10", "--", "-k", "abcd1234"]);
+ expect(cordova.raw.build).toHaveBeenCalledWith({verbose: false, silent: false, platforms: ["blackberry10"], options: ["-k", "abcd1234"]});
+ });
+
+ it("will consume the first instance of -d", function () {
+ cli(["node", "cordova", "-d", "build", "blackberry10", "--", "-k", "abcd1234", "-d"]);
+ expect(cordova.raw.build).toHaveBeenCalledWith({verbose: true, silent: false, platforms: ["blackberry10"], options: ["-k", "abcd1234", "-d"]});
+ });
+
+ it("will consume the first instance of --verbose", function () {
+ cli(["node", "cordova", "--verbose", "build", "blackberry10", "--", "-k", "abcd1234", "--verbose"]);
+ expect(cordova.raw.build).toHaveBeenCalledWith({verbose: true, silent: false, platforms: ["blackberry10"], options: ["-k", "abcd1234", "--verbose"]});
+ });
+
+ it("will consume the first instance of either --verbose of -d", function () {
+ cli(["node", "cordova", "--verbose", "build", "blackberry10", "--", "-k", "abcd1234", "-d"]);
+ expect(cordova.raw.build).toHaveBeenCalledWith({verbose: true, silent: false, platforms: ["blackberry10"], options: ["-k", "abcd1234", "-d"]});
+ });
+
+ it("will consume the first instance of either --verbose of -d", function () {
+ cli(["node", "cordova", "-d", "build", "blackberry10", "--", "-k", "abcd1234", "--verbose"]);
+ expect(cordova.raw.build).toHaveBeenCalledWith({verbose: true, silent: false, platforms: ["blackberry10"], options: ["-k", "abcd1234", "--verbose"]});
+ });
+
+ it("will consume the first instance of --silent", function () {
+ cli(["node", "cordova", "--silent", "build", "blackberry10", "--", "-k", "abcd1234", "--silent"]);
+ expect(cordova.raw.build).toHaveBeenCalledWith({verbose: false, silent: true, platforms: ["blackberry10"], options: ["-k", "abcd1234", "--silent"]});
+ });
+ });
+
+ describe("plugin", function () {
+ beforeEach(function () {
+ spyOn(cordova.raw, "plugin").andReturn(Q());
+ });
+
+ it("will pass variables", function () {
+ cli(["node", "cordova", "plugin", "add", "facebook", "--variable", "FOO=foo"]);
+ expect(cordova.raw.plugin).toHaveBeenCalledWith(
+ "add",
+ ["facebook"],
+ jasmine.any(Object)
+ );
+ var opts = cordova.raw.plugin.calls[0].args[2];
+ expect(opts.cli_variables.FOO).toBe('foo');
+ });
+ });
+});