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
| 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 |
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
| 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: |
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 'test_helper' | |
| class Devise::RegistrationsControllerTest < ActionController::TestCase | |
| context "edit without authenticate account" do | |
| setup do | |
| sign_out :account | |
| get :edit | |
| end |
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 'rubygems' | |
| require 'sinatra' | |
| require 'myapp.rb' | |
| run MyApp |
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 '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? |
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 'rubygems' | |
| require 'spec' | |
| require 'spec/interop/test' | |
| require 'sinatra/test' | |
| Sinatra::Default.set( | |
| :environment => :test, | |
| :run => false, | |
| :raise_errors => true, | |
| :logging => false |
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 'rake' | |
| require 'rake/rdoctask' | |
| require 'spec/rake/spectask' | |
| require 'sequel' | |
| require File.join( File.dirname(__FILE__), 'lib/database' ) | |
| namespace :myapp do | |
| @environment = nil |
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 '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? |