Edit in JSFiddle

describe('creating custom matchers', function() {
    beforeEach(function() {
        this.addMatchers({
            toBeGET: function() {
                var actual = this.actual.method;
                return actual === 'GET';
            },
            toHaveUrl: function(expected) {
                var actual = this.actual.url;
                this.message = function() {
                    return "Expected request to have url " + expected + " but was " + actual
                };
                return actual === expected;
            }
        });
    });

    it('should be GET', function() {
        var request = {
            method: 'GET'
        };
        expect(request).toBeGET();
    });

    it('should have url /products.json', function() {
        var request = {
            url: '/products.json'
        };
        expect(request).toHaveUrl('/products.json');
    });

    // this will fail with nice message
    it('should have url /tasks.json', function() {
        var request = {
            url: '/projects.json'
        };
        expect(request).toHaveUrl('/tasks.json');
    });
});

execJasmine();