Skip to content

Instantly share code, notes, and snippets.

@thehig
Created June 22, 2016 14:44
Show Gist options
  • Save thehig/0ecad92389c7c12caf832b4e8e99b71d to your computer and use it in GitHub Desktop.
Save thehig/0ecad92389c7c12caf832b4e8e99b71d to your computer and use it in GitHub Desktop.
coffee: Data driven test
# This is a test snippet that will iterate over a collection of expected values, and compare them against the test values
describe "option 2", ->
it "has 5 observableValues", -> expect(product.required_fields[1].observableValues).to.have.length(5)
somoText = (text, i) -> it "[" + i + "] text '" + text + "'", -> expect(product.required_fields[1].observableValues[i]).to.have.property('text', text)
somoText(item, i) for item, i in ["Color: Snow", "Color: Sky Blue", "Color: Gray Granite", "Color: Soft Pink", "Color: Light Lemon"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment