Sha256: fc7f7aa8c2fd3a07c5edc80db721628321ef576bf9fa86bd988cd78c3f25b9b5

Contents?: true

Size: 1.69 KB

Versions: 1

Compression:

Stored size: 1.69 KB

Contents

describe 'Negative specs'

  it 'should fail'
    'test'.should.not_eql 'test' 
  end

  it 'should fail with one faulty assertion'
    'test'.should.equal 'test' 
    'test'.should.equal 'foo' 
  end
  
  it 'should fail and print array with square braces'
    [1,2].should.equal [1,3] 
  end
  
  it 'should fail and print nested array'
    [1, ['foo']].should.equal [1, ['bar', ['whatever', 1.0, { foo : 'bar', bar : { 1 : 2 } }]]]
  end
  
  it 'should fail and print html elements'
    elem = document.createElement('a')
    elem.setAttribute('href', 'http://vision-media.ca')
    elem.should.not.eql elem
  end
  
  it 'should fail with selector for jQuery objects'
    elem = { jquery : '1.3.1', selector : '.foobar' } 
    elem.should.eql 'foo'
  end
  
  it 'should fail with negative message'
    '1'.should.not.be_true
  end
  
  it 'should fail with positive message'
    false.should.be_true
  end
  
  it 'should fail with function body'
    -{ throw 'foo' }.should.not.throw_error
  end
  
  it 'should fail with message of first failure'
    true.should.be_true
    'bar'.should.match(/foo/gm)
    'bar'.should.include 'foo'
  end
  
  it 'should fail with list'
    ['foo', 'bar'].should.include 'foo', 'car'
  end
  
  it 'should catch exceptions throw within specs'
    throw new Error('Oh noes!')
  end
  
  it 'should catch improper exceptions'
    throw 'oh noes'
  end
  
  it 'should catch proper exceptions'
    iDoNotExist.neitherDoI()
  end
  
end

describe 'Contexts'
  before 
    JSpec.context = { iLike : 'cookies' }
  end

  after
    JSpec.context = null
  end

  it 'should be replaceable'
    iLike.should.equal 'cookies'
  end
end

describe 'Misc'
  it 'requires implementation'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
visionmedia-jspec-2.0.0 spec/spec.js