Permalink
Browse files

Add missing specs to CLI configuration

  • Loading branch information...
1 parent 5ff71bb commit fc662ed686f946c2daed4dfdba7cb56a89bc3e0c @jbpros jbpros committed Dec 25, 2012
Showing with 32 additions and 6 deletions.
  1. +32 −6 spec/cucumber/cli/configuration_spec.js
@@ -29,9 +29,13 @@ describe("Cucumber.Cli.Configuration", function () {
});
describe("getFormatter()", function () {
+ var shouldSnippetsBeInCoffeeScript, formatterOptions;
+
beforeEach(function () {
+ shouldSnippetsBeInCoffeeScript = createSpy("should snippets be in CS?");
+ formatterOptions = {coffeeScriptSnippets: shouldSnippetsBeInCoffeeScript};
spyOnStub(argumentParser, 'getFormat').andReturn("progress");
- spyOnStub(argumentParser, 'shouldSnippetsBeInCoffee').andReturn(false);
+ spyOnStub(argumentParser, 'shouldSnippetsBeInCoffeeScript').andReturn(shouldSnippetsBeInCoffeeScript);
spyOn(Cucumber.Listener, 'JsonFormatter');
spyOn(Cucumber.Listener, 'ProgressFormatter');
spyOn(Cucumber.Listener, 'PrettyFormatter');
@@ -43,6 +47,11 @@ describe("Cucumber.Cli.Configuration", function () {
expect(argumentParser.getFormat).toHaveBeenCalled();
});
+ it("checks whether the step definition snippets should be in CoffeeScript", function () {
+ configuration.getFormatter();
+ expect(argumentParser.shouldSnippetsBeInCoffeeScript).toHaveBeenCalled();
+ });
+
describe("when the formatter name is \"json\"", function () {
var formatter;
@@ -54,7 +63,7 @@ describe("Cucumber.Cli.Configuration", function () {
it("creates a new progress formatter", function () {
configuration.getFormatter();
- expect(Cucumber.Listener.JsonFormatter).toHaveBeenCalled();
+ expect(Cucumber.Listener.JsonFormatter).toHaveBeenCalledWith(formatterOptions);
});
it("returns the progress formatter", function () {
@@ -73,7 +82,7 @@ describe("Cucumber.Cli.Configuration", function () {
it("creates a new progress formatter", function () {
configuration.getFormatter();
- expect(Cucumber.Listener.ProgressFormatter).toHaveBeenCalled();
+ expect(Cucumber.Listener.ProgressFormatter).toHaveBeenCalledWith(formatterOptions);
});
it("returns the progress formatter", function () {
@@ -92,7 +101,7 @@ describe("Cucumber.Cli.Configuration", function () {
it("creates a new pretty formatter", function () {
configuration.getFormatter();
- expect(Cucumber.Listener.PrettyFormatter).toHaveBeenCalled();
+ expect(Cucumber.Listener.PrettyFormatter).toHaveBeenCalledWith(formatterOptions);
});
it("returns the pretty formatter", function () {
@@ -111,7 +120,7 @@ describe("Cucumber.Cli.Configuration", function () {
it("creates a new summary formatter", function () {
configuration.getFormatter();
- expect(Cucumber.Listener.SummaryFormatter).toHaveBeenCalled();
+ expect(Cucumber.Listener.SummaryFormatter).toHaveBeenCalledWith(formatterOptions);
});
it("returns the summary formatter", function () {
@@ -266,7 +275,7 @@ describe("Cucumber.Cli.Configuration", function () {
});
});
- describe("isVersionRequired()", function () {
+ describe("isVersionRequested()", function () {
beforeEach(function () {
spyOnStub(argumentParser, 'isVersionRequested');
});
@@ -282,4 +291,21 @@ describe("Cucumber.Cli.Configuration", function () {
expect(configuration.isVersionRequested()).toBe(isVersionRequested);
});
});
+
+ describe("shouldSnippetsBeInCoffeeScript()", function () {
+ beforeEach(function () {
+ spyOnStub(argumentParser, 'shouldSnippetsBeInCoffeeScript');
+ });
+
+ it("asks the argument parser whether the version was requested or not", function () {
+ configuration.shouldSnippetsBeInCoffeeScript();
+ expect(argumentParser.shouldSnippetsBeInCoffeeScript).toHaveBeenCalled();
+ });
+
+ it("returns the answer from the argument parser", function () {
+ var shouldSnippetsBeInCoffeeScript = createSpy("is version requested?");
+ argumentParser.shouldSnippetsBeInCoffeeScript.andReturn(shouldSnippetsBeInCoffeeScript);
+ expect(configuration.shouldSnippetsBeInCoffeeScript()).toBe(shouldSnippetsBeInCoffeeScript);
+ });
+ });
});

0 comments on commit fc662ed

Please sign in to comment.