Edit in JSFiddle

// Code under test
var MyApp = function () {
    var flag = false;
    
    var setFlag = function () {
        flag = true;
    };

    return {
        flag: flag,
        setFlag: setFlag
    };
};

// Specs
describe("Testing spies", function () {

    it("Should skip over the function being spied on", function () {
        // Arrange
        var myApp = new MyApp();
        spyOn(myApp, "setFlag");

        // Act
        // Should set flag to true, but it's spied on
        myApp.setFlag(); 
        
        // Assert
        // So the flag is still set to false
        expect(myApp.flag).toEqual(false);
    });

});