Skip to content

Instantly share code, notes, and snippets.

View glesage's full-sized avatar

Geoffroy Lesage glesage

View GitHub Profile
class DataController < ApplicationController
# GET /data
# GET /data.json
def index
@data = Datum.all
render json: @data
end
# GET /data/1
require 'test_helper'
class DataControllerTest < ActionController::TestCase
test "should create data" do
assert_difference('Data.count') do
post '/data', { # Same error when replaced with /datum
name: 'my_name',
},
{
/home/jeff/.rvm/gems/ruby-2.1.1/gems/turn-0.9.7/lib/turn/reporter.rb:107:in `limit_backtrace': undefined method `to_i' for true:TrueClass (NoMethodError)
from /home/jeff/.rvm/gems/ruby-2.1.1/gems/turn-0.9.7/lib/turn/reporter.rb:74:in `clean_backtrace'
from /home/jeff/.rvm/gems/ruby-2.1.1/gems/turn-0.9.7/lib/turn/reporters/progress_reporter.rb:100:in `block (2 levels) in post_report'
from /home/jeff/.rvm/gems/ruby-2.1.1/gems/turn-0.9.7/lib/turn/reporters/progress_reporter.rb:97:in `each'
from /home/jeff/.rvm/gems/ruby-2.1.1/gems/turn-0.9.7/lib/turn/reporters/progress_reporter.rb:97:in `block in post_report'
from /home/jeff/.rvm/gems/ruby-2.1.1/gems/turn-0.9.7/lib/turn/reporters/progress_reporter.rb:96:in `each'
from /home/jeff/.rvm/gems/ruby-2.1.1/gems/turn-0.9.7/lib/turn/reporters/progress_reporter.rb:96:in `post_report'
from /home/jeff/.rvm/gems/ruby-2.1.1/gems/turn-0.9.7/lib/turn/reporters/progress_reporter.rb:49:in `finish_suite'
from /home/je
ERROR (0:00:00.175) test_should_create_a_session
ActiveModel::ForbiddenAttributesError
@ /home/jeff/.rvm/gems/ruby-2.1.1/gems/activemodel-4.0.3/lib/active_model/forbidden_attributes_protection.rb:21:in `sanitize_for_mass_assignment'
/home/jeff/.rvm/gems/ruby-2.1.1/gems/activerecord-4.0.3/lib/active_record/attribute_assignment.rb:21:in `assign_attributes'
/home/jeff/.rvm/gems/ruby-2.1.1/gems/activerecord-4.0.3/lib/active_record/core.rb:460:in `init_attributes'
/home/jeff/.rvm/gems/ruby-2.1.1/gems/activerecord-4.0.3/lib/active_record/core.rb:185:in `initialize'
/home/jeff/.rvm/gems/ruby-2.1.1/gems/activerecord-4.0.3/lib/active_record/inheritance.rb:27:in `new'
/home/jeff/.rvm/gems/ruby-2.1.1/gems/activerecord-4.0.3/lib/active_record/inheritance.rb:27:in `new'
app/controllers/a_sessions_controller.rb:21:in `create'
/home/jeff/.rvm/gems/ruby-2.1.1/gems/actionpack-4.0.3/lib/abstract_controller/base.rb:189:in `process_action'
ERROR (0:00:00.177) test_should_create_a_session
No route matches {:agent_id=>"1", :expired=>false, :ip_address=>"255.255.255.255", :controller=>"a_sessions", :action=>"/a_session"}
@ /home/jeff/.rvm/gems/ruby-2.1.1/gems/actionpack-4.0.3/lib/action_dispatch/journey/formatter.rb:39:in `generate'
/home/jeff/.rvm/gems/ruby-2.1.1/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:601:in `generate'
/home/jeff/.rvm/gems/ruby-2.1.1/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:631:in `generate'
/home/jeff/.rvm/gems/ruby-2.1.1/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:626:in `generate_extras'
/home/jeff/.rvm/gems/ruby-2.1.1/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:622:in `extra_keys'
/home/jeff/.rvm/gems/ruby-2.1.1/gems/actionpack-4.0.3/lib/action_controller/test_case.rb:189:in `assign_parameters'
/home/jeff/.rvm/gems/ruby-2.1.1/gems/actionpack-4.0.3/lib/action_control
// Zipcode.json
{
"name": "Zipcode",
"base": "PersistedModel",
"properties": {
"zipcode": {
"type": "string",
"required": true,
"length": 5
}
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
(window.NREUM || (NREUM = {})).loader_config = {
xpid: "UgIOUFVQGwcJUFlXBwc="
};
window.NREUM || (NREUM = {}), __nr_require = function(t, e, n) {
function r(n) {
@glesage
glesage / Script difference
Last active August 29, 2015 14:19
Script difference
#### Script 1 ####
mkdir -p "~/Library/MobileDevice/Provisioning Profiles"
cp profiles/* "~/Library/MobileDevice/Provisioning Profiles/"
whoami --> distiller
ls -al "~/Library/MobileDevice/Provisioning Profiles" --> -rw-r--r-- 1 distiller staff 9854 Apr 23 13:29 db11a47d-1999-4704-9e07-bf7e852e00c6.mobileprovision
whoami --> distiller
ls -al "~/Library/MobileDevice/Provisioning Profiles" --> -rw-r--r-- 1 distiller staff 9854 Apr 23 13:29 db11a47d-1999-4704-9e07-bf7e852e00c6.mobileprovision
Utility.benchmarkDB = function (next)
{
Facility = Utility.app.models.Facility;
FacilityDetail = Utility.app.models.FacilityDetail;
Driver = Utility.app.models.Driver;
DriverHour = Utility.app.models.DriverHour;
/**
@glesage
glesage / SimplifyExpressionsVisitor.java
Created May 30, 2015 17:48
SimplifyExpressionsVisitor.java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package malgol.transform;
import jdk.nashorn.internal.ir.Block;
import malgol.ast.*;
import malgol.common.Operator;
import malgol.type.*;