This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Factory.define 'user', User, | |
| name: -> Faker.Name.findName() | |
| email: Faker.uniq 'userEmail', Faker.Internet.email.bind(Faker.Internet) | |
| passwordHash: '$2a$10$iZ8vqtQXQ6...' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {Factory} = require '../../../support/spec_helper' | |
| request = require 'request' | |
| $ = require 'jquery' | |
| describe 'Orders Controller', -> | |
| describe 'when there is an order for pickup', -> | |
| beforeEach -> | |
| Factory.create 'orderForPickup' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { Factory } = require '../../support/spec_helper' | |
| UserEditView = require '../../../../client/js/views/user_edit_view' | |
| describe 'UserEditView', -> | |
| describe 'render', -> | |
| {user, view} = {} | |
| beforeEach -> | |
| user = Factory.create 'user' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = UserMixin = (User) -> | |
| _(User.prototype).extend | |
| holla: -> | |
| "Hey #{@get('name')}!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UserMixin = require '../../../../shared/user_mixins' | |
| module.exports = class User extends Backbone.Model | |
| idAttribute: '_id' | |
| urlRoot: '/users' | |
| UserMixin(User) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mongoose = require 'mongoose' | |
| UserMixin = require '../../shared/user_mixins' | |
| schema = new mongoose.Schema | |
| email: { type: String, lowercase: true, required: true, unique: true } | |
| name: { type: String, required: true } | |
| passwordHash: { type: String } | |
| User = mongoose.model('User', schema) | |
| UserMixin(User) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _ = require 'underscore' | |
| accounting = require 'accounting' | |
| format = require '../shared/lib/format' | |
| _.mixin | |
| formatNumber: accounting.formatNumber | |
| formatDate: format.formatDate | |
| formatDateRange: format.formatDateRange |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| User = require '../shared/models/user' | |
| UserEditView = require './views/user_edit_view' | |
| $ -> | |
| router = new Backbone.Router { | |
| 'users/:userId/edit': 'user-edit' | |
| } | |
| router.on 'route:user-edit', (userId) -> | |
| user = new User(_id: userId) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| templates = require '../../shared/lib/templates' | |
| User = require '../../shared/models/user' | |
| withManagedForm = require '../lib/with_managed_form' | |
| template = -> | |
| h2 @user.get("name") | |
| form '.edit-user', -> | |
| label "Name" | |
| input name: "name", type: "text" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > db.users.find({ email: /gmail\.com$/i }).pretty() | |
| { | |
| "_id" : ObjectId("5031b5a6166d270200001858"), | |
| "name" : "Dan Theman", | |
| "email" : "[email protected]", | |
| "passwordHash" : "####", | |
| "updatedAt" : ISODate("2012-08-20T03:57:26.584Z"), | |
| "createdAt" : ISODate("2012-08-20T03:57:26.584Z"), | |
| } | |
| ... |