Sha256: 9bd893cd63b8942dfb28e4d8670c9414f32614112250f065b1196f611a13683e

Contents?: true

Size: 795 Bytes

Versions: 2

Compression:

Stored size: 795 Bytes

Contents

var spec = new QSpec("Extensions");

spec.should("add 'method' to the Function prototype", function() {
	ok(is_defined(Function.prototype.method), "Object.prototype.method is defined");
	
	String.method('test_method', function() {
		return 'This is a test';
	});
	
	equals('Hello'.test_method(), 'This is a test', 'can create a prototype method with method');
});

spec.should("test a condition with unless", function() {
   var is_true = false;
   
   unless (false,
      function() {
         is_true = true;
      }
   );
   
   ok(is_true, "unless works");
   
   var does_fallback_work = false;
   
   unless (true,
      function() {
      
      },
      function() {
         does_fallback_work = true;
      }
   );
   
   ok(does_fallback_work, 'fallback works');
});

spec.run_all();

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ninjs-0.14.1 repository/ninjs/tests/extension.test.js
ninjs-0.14.0 repository/ninjs/tests/extension.test.js