Sha256: 3abcaacacbe5533fcd666614afa4359296b8920763fa0d47e9b17eb65acc11ea

Contents?: true

Size: 1.18 KB

Versions: 40

Compression:

Stored size: 1.18 KB

Contents

getJasmineRequireObj().toThrow = function(j$) {

  function toThrow(util) {
    return {
      compare: function(actual, expected) {
        var result = { pass: false },
          threw = false,
          thrown;

        if (typeof actual != 'function') {
          throw new Error('Actual is not a Function');
        }

        try {
          actual();
        } catch (e) {
          threw = true;
          thrown = e;
        }

        if (!threw) {
          result.message = 'Expected function to throw an exception.';
          return result;
        }

        if (arguments.length == 1) {
          result.pass = true;
          result.message = function() { return 'Expected function not to throw, but it threw ' + j$.pp(thrown) + '.'; };

          return result;
        }

        if (util.equals(thrown, expected)) {
          result.pass = true;
          result.message = function() { return 'Expected function not to throw ' + j$.pp(expected) + '.'; };
        } else {
          result.message = function() { return 'Expected function to throw ' + j$.pp(expected) + ', but it threw ' +  j$.pp(thrown) + '.'; };
        }

        return result;
      }
    };
  }

  return toThrow;
};

Version data entries

40 entries across 40 versions & 2 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/bootstrap-tagsinput/lib/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.11.0 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.10.5 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.10.4 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.10.3 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.10.2 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.10.1 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.10.0 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.9.1 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.9.0 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.8.2 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.8.1 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.8.0 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.7.8 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.7.7 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.7.6 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.7.5 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.7.4 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.7.3 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js
upjs-rails-0.7.2 spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js