Skip to content

Instantly share code, notes, and snippets.

@kristopher
Created April 3, 2009 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristopher/89616 to your computer and use it in GitHub Desktop.
Save kristopher/89616 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
jShoulda.useStyle('describe');
describe('jRspec', {},
describe('"should"', {},
it('should be defined should on object', function() {
var obj = {};
obj.should.should(this).equal(jRspec.should);
}),
it('should pass if with a simple equals case', function() {
'1'.should(this).equal('1')
}),
it('should pass with a simple be case', function() {
var obj = {}
obj.should(this).equal(obj)
}),
it('should pass with a simple not equals case', function() {
'2'.should(this).not_equal('1')
}))(),
describe('stub', {
setup: function() {
var obj = { test: 'test' }
}
},
it("should stub a function", function() {
var obj = { test: 'test' }
obj.stub('test')
'test'.should(this).not_equal(obj.test)
Moksi.revert()
}),
it("and_return should set the return value", function() {
var obj = { test: 'test' }
obj.stub('test').and_return('stubbed')
obj.test.should(this).equal('stubbed')
Moksi.revert()
}))())();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment