This file contains 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 "test/unit" | |
require File.dirname(__FILE__) + '/business_hours' | |
class BusinessHoursTest < Test::Unit::TestCase | |
def setup | |
@hours = BusinessHours.new("8:00 AM", "5:00 PM") | |
end | |
def test_within_working_hours | |
assert_equal Time.parse("Dec 21, 2009 3:05 PM"), @hours.calculate_deadline(5*60, "Dec 21, 2009 3:00 PM") |
This file contains 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 'time' | |
class BusinessHours | |
def initialize opening, closing | |
@hours = Hash.new( [opening, Time.parse(closing)-Time.parse(opening)] ) | |
end | |
def calculate_deadline interval, drop_off | |
target = seconds_before_closing( time = Time.parse(drop_off) ) |
This file contains 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" | |
Busboy = require "busboy" | |
secrets = require "../config/secrets" | |
GridStream = require "gridfs-stream" | |
Files = require "../models/files" | |
sharp = require "sharp" | |
async = require "async" | |
NewerOlder