Skip to content

Instantly share code, notes, and snippets.

View graemenelson's full-sized avatar

Graeme Nelson graemenelson

  • Makool LLC
  • Portland, Oregon
View GitHub Profile
@graemenelson
graemenelson / mp-test.js
Created October 28, 2015 18:13
Multiplication Test
import {assert} from 'chai'
const multiply = (a, b) => {
return sortAndCombined(a) * sortAndCombined(b)
}
const sortAndCombined = (arr) => {
// since we only allow 0 to 9, we can use the base #sort for array
// if we allowed above 9, then 10 would come before 2 and more work
// would need to be done
test: edit without authenticate account should redirect to . (Devise::RegistrationsControllerTest):
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
/Users/graemenelson/.rvm/gems/ruby-1.9.2-p0@rails3_shoulda/bundler/gems/devise-219c05c/app/controllers/devise/registrations_controller.rb:72:in `authenticate_scope!'
/Users/graemenelson/.rvm/gems/ruby-1.9.2-p0@rails3_shoulda/gems/activesupport-3.0.0.rc/lib/active_support/callbacks.rb:430:in `_run__1014019186873122880__process_action__886626869220559486__callbacks'
/Users/graemenelson/.rvm/gems/ruby-1.9.2-p0@rails3_shoulda/gems/activesupport-3.0.0.rc/lib/active_support/callbacks.rb:404:in `_run_process_action_callbacks'
/Users/graemenelson/.rvm/gems/ruby-1.9.2-p0@rails3_shoulda/gems/activesupport-3.0.0.rc/lib/active_support/callbacks.rb:93:in `run_callbacks'
/Users/graemenelson/.rvm/gems/ruby-1.9.2-p0@rails3_shoulda/gems/actionpack-3.0.0.rc/lib/abstract_controller/callbacks.rb:17:
require 'test_helper'
class Devise::RegistrationsControllerTest < ActionController::TestCase
context "edit without authenticate account" do
setup do
sign_out :account
get :edit
end
require 'rubygems'
require 'sinatra'
require 'myapp.rb'
run MyApp
require 'imanip'
require 'sequel'
# load the support libraries. loading models gets called in configure
%w( database helpers ).each { |lib| require "lib/#{lib}.rb" }
class MyApp < Sinatra::Default
configure do
set :sessions, !test?
require 'rubygems'
require 'spec'
require 'spec/interop/test'
require 'sinatra/test'
Sinatra::Default.set(
:environment => :test,
:run => false,
:raise_errors => true,
:logging => false
require 'rake'
require 'rake/rdoctask'
require 'spec/rake/spectask'
require 'sequel'
require File.join( File.dirname(__FILE__), 'lib/database' )
namespace :myapp do
@environment = nil
require 'sequel'
# Database
#
# A helper class to wrap calls to Sequel Database, primarily for getting a database from a YAML config
# file and for migrating.
class Database
@@configuration_file = File.join( File.dirname(__FILE__), "../config/database.yml" )
raise Exception.new("No '#{@@configuration_file}' file was found. ") if @@configuration_file.nil?