This is a short list of all of Aruba's different Cucumber step definitions that are available.
Given /The default aruba timeout is (\d+) seconds/
Given /^I'm using a clean gemset "([^"]*)"$/
Given /^a directory named "([^"]*)"$/
Reference: BCP Business Center
#!/bin/bash | |
# Simple script to run the createuser and createdb | |
# commands after a local/server install of PostgreSQL | |
# Exit as soon as any line in the bash script fails | |
# & prints each command executed (prefix with ++) | |
set -e | |
# Make sure we have a name parameter |
// Simulate a network request by using setTimeout | |
function fakeNetworkCall(url, callback) { | |
let returnData = { name: url }; | |
setTimeout(() => callback(returnData), 1500); | |
}; | |
// Make the first call | |
fakeNetworkCall('/api/endpoint/1/', (response1) => { | |
// When the call is done, the callback function | |
// is called, so we can work with the data here. |
// Simulate a network request by using setTimeout | |
// This achieves the same thing as our version above. | |
// This time though, we are going to return a Promise! | |
function fakeNetworkCall(url) { | |
const promise = new Promise((resolve, reject) => { | |
setTimeout(() => resolve(url), 1500); | |
}); | |
return promise; | |
} |
// Fancy new function syntax | |
fakeNetworkCall('/api/endpoint/1/') | |
.then(result => fakeNetworkCall('/api/endpoint/2/')) | |
.then(result => fakeNetworkCall('/api/endpoint/3/')) | |
// Maybe we finally call a render method on our last request? | |
.then(result => renderToPage(result)) | |
// Make sure any errors are caught. | |
.catch(error => handleError(error)) |
// Fake network calls again, same as before. | |
// We don't have to do much besides make it obvious this is async | |
// async/await enhances Promises, it doesn't replace them! | |
function fakeNetworkCall(url) { | |
const promise = new Promise((resolve, reject) => { | |
setTimeout(() => resolve(url), 1500); | |
}); | |
return promise; | |
} |
<?php | |
// Normal php conditional | |
if (true) { | |
echo 'This normal one is true!'; | |
} else { | |
echo 'Its false'; | |
} | |
// Alternative syntax | |
if (true): |
/** | |
* Adds two numbers together | |
* | |
* @param {number} first The First Number | |
* @param {number} second The Second Number | |
* @returns {number} | |
*/ | |
function add(first, second) { | |
return first + second; | |
} |
// @flow | |
/** | |
* Adds two numbers together | |
*/ | |
function add(first: number, second: number): number { | |
return first + second; | |
} |