Feature: Converting meters
In order to get a human-readable distance
As a person working with a tool that only outputs meters
I want to convert meters to the closest resonable units
Background:
Given I am working in meters
Scenario: easy conversion
When I convert 1000
Then the result should be '1000 m is 1 km'
Scenario Outline: alternative conversions
When I convert <input>
Then the result should be '<result>'
Examples:
| input | result |
| 0.1 | 0.1 m is 10 cm |
| 0.001 | 0.001 m is 1 mm |
// Cucumber and chai have been loaded in the browser
var Given = Cucumber.Given;
var When = Cucumber.When;
var Then = Cucumber.Then;
var expect = chai.expect;
///// Step definitions /////
// use 'Given', 'When' and 'Then' to declare step definitions//
Given('I am working in meters', function() {
this.converter = new workroomprds.converter.NewConverter({units:workroomprds.converter.metricUnits});
});
When('I convert {int}', function(inputInt) {
this.input = parseInt(inputInt);
});
When('I convert {float}', function(inputFloat) {
this.input = parseFloat(inputFloat);
});
Then('the result should be {string}', function(checkString) {
expect(this.converter.transformData(this.input)).to.eql(checkString);
});