Upgrade to Pro — share decks privately, control downloads, hide ads and more …

jasmine enhancers

jasmine enhancers

A summary of a bunch of my favorite Jasmine tools.

Interested in training? Contact us at http://test-double.com

Justin Searls

November 21, 2011
Tweet

More Decks by Justin Searls

Other Decks in Programming

Transcript

  1. beforeEach -> @subject = new Button() @result = @subject.press() it

    “goes ‘ohhh yeah’” expect(@result).toBe(‘ohhh yeah’) Given -> @subject = new Button() When -> @result = @subject.press() Then -> @result == “ohhh yeah”
  2. When -> @config = createConfig() Then -> @config.url == "http://andy.vida"

    Then -> @config.name == "Matt Boston" Then -> @config.bestFriend == "Isaac Sanders" Then -> @config.bestBritishFriend == "Greg Malcolm"
  3. describe "#createConfig", -> When -> @config = createConfig() Then( ->

    @config.url == "http://andy.vida") .Then( -> @config.name == "Matt Boston") .Then( -> @config.bestFriend == "Isaac Sanders") .Then( -> @config.bestBritishFriend == "Greg Malcolm")
  4. $foo = inject('foo') <div class="foo"></div> $bar = $foo.inject('bar') <div class="foo"><div

    class="bar"></div></div> $input = $bar.inject(el: 'input', id: 'woot').val(42) <div...><div...><input id="woot" value="42"/></div></div>