These are chat archives for waterlock/waterlock

30th
Mar 2015
Steven
@rh0dium
Mar 30 2015 20:38
Hey guys - I'm seeing an issue with trying to write a basic test against waterlock. I'm sure it's PEBKAC but I can't figure it out. Basically I'm seeing this error.
 TypeError: Cannot read property 'models' of undefined
    at Waterlock.Auth (/Users/sklass/Documents/Projects/IC_Manage/gdp_server/node_modules/waterlock/lib/waterlock.js:34:20)
Basically waterlock.js is calling this.sails.models and sails is not defined?
David Rivera
@duhruh
Mar 30 2015 20:41
interesting
sails should be defined at that point
i'll have to do some testing when i get a chance
Steven
@rh0dium
Mar 30 2015 20:42
It seems super basic but I'm not alone. - waterlock/waterlock#66
They are getting effectively the same thing
David Rivera
@duhruh
Mar 30 2015 20:44
ah yea you need to define global.sails before calling waterlock
so there's that first
then the other thing
well
first make sure you're defining global.sails
see if that fixes your issue
i need to make some time to go over this myself
feel free to comment on the github issue with your findings
Steven
@rh0dium
Mar 30 2015 20:45
Where would I do this - I've got bootstrap.js that gets loaded first?
David Rivera
@duhruh
Mar 30 2015 20:46
that might be okay
just anywhere before testing waterlock functionality
i'm not familiar with your testing setup
let me know what you find
Note it's defined on L:26 ( I think that's right)
Steven
@rh0dium
Mar 30 2015 21:37
Ahh - This works.. var Sails = global.sails = require('sails');