Skip to content
This repository was archived by the owner on Dec 27, 2018. It is now read-only.
This repository was archived by the owner on Dec 27, 2018. It is now read-only.

Stubs does not work correctly on Assets api inside a method call #17

@kelbongoo

Description

@kelbongoo

I tried using stubs to stub a call to Assets.getText, but it doesn't seem to work. Using latest Jasmine server integration on meteor 1.2.0.1.

describe('hello test', function(){
    beforeAll(function(){
        stubs.create('getText', Assets, 'getText');
        stubs.getText.returns('<div>Foo bar</div>');
    });
    describe('a test', function(){
        console.log('Assets.getText', Assets.getText('foo')); // works here - returns '<div>Foo bar</div>'
        myMethods['testMethod']();
    });
});

myMethods = {
    testMethod : function(){
         console.log('stubs.getText', stubs.getText); // correct value here
        console.log('Assets.getText', Assets.getText('foo')); // INCORRECT - uses original Assets.getText
    }
};

so the correct stubs.getText is available inside the method, but it does not actually stub Assets.getText...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions