Skip to content

Instantly share code, notes, and snippets.

1)
File.read raises a Errno::EISDIR when passed a path that is a directory FAILED
Expected Errno::EISDIR but got Errno::EINVAL (Invalid argument - read(2) failed)
{ } in main.__script__ at spec/ruby/core/file/shared/read.rb:6
Kernel(Object)#instance_eval at kernel/common/eval.rb:158
{ } in Enumerable(Array)#all? at kernel/common/enumerable.rb:205
Array#each at kernel/bootstrap/array.rb:163
Enumerable(Array)#all? at kernel/common/enumerable.rb:205
Array#each at kernel/bootstrap/array.rb:163
main.__script__ at spec/ruby/core/file/read_spec.rb:4
1)
File.read raises a Errno::EISDIR when passed a path that is a directory FAILED
Expected Errno::EISDIR but got Errno::EINVAL (Invalid argument - read(2) failed)
{ } in main.__script__ at spec/ruby/core/file/shared/read.rb:6
Kernel(Object)#instance_eval at kernel/common/eval.rb:158
{ } in Enumerable(Array)#all? at kernel/common/enumerable.rb:205
Array#each at kernel/bootstrap/array.rb:163
Enumerable(Array)#all? at kernel/common/enumerable.rb:205
Array#each at kernel/bootstrap/array.rb:163
main.__script__ at spec/ruby/core/file/read_spec.rb:4
chris@delacroix:~$ irb
ree-1.8.7-2010.02 > File.read(".")
Errno::EINVAL: Invalid argument - .
from (irb):1:in `read'
from (irb):1
ree-1.8.7-2010.02 >
require 'rubygems'
require 'benchmark'
require 'haml'
engine = Haml::Engine.new(File.read("template.haml"))
Benchmark.bm do |x|
x.report { 1000.times{ engine.render } }
end
Fabrication::DuplicateFabricatorError in 'Fabrication::Support.find_definitions before(:all)'
'awesome_object' is already defined
/home/chris/fabrication/lib/fabrication/fabricator.rb:6:in `define'
/home/chris/fabrication/lib/fabrication.rb:26:in `Fabricator'
/home/chris/fabrication/spec/fabricators.rb:1:in `<top (required)>'
/home/chris/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `load'
/home/chris/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `block in load'
/home/chris/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
/home/chris/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
/home/chris/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
require 'mongoid'
Mongoid.configure { |config| config.master = Mongo::Connection.new.db 'mongoid_test' }
class User
include Mongoid::Document
field :email
field :name
class Quiz
include Mongoid::Document
embeds_many :topics
# fields...
end
class Topic
include Mongoid::Document
embedded_in :quiz
Loading development environment (Rails 3.0.3)
ruby-1.9.2-p0 > Quiz.collection.remove
=> true
ruby-1.9.2-p0 > Fabricate :built_quiz
=> #<Quiz _id: 4d2e3c770de0690d95000001, created_at: 2011-01-12 23:42:47 UTC, updated_at: 2011-01-12 23:42:47 UTC, user_id: BSON::ObjectId('4d2e3c770de0690d95000002'), time: 0, number: 1, built_at: 2011-01-12 23:42:47 UTC, completed_at: nil, graded_at: nil>
ruby-1.9.2-p0 > Quiz.count
=> 1
ruby-1.9.2-p0 > Quiz.collection.find_one
=> {"_id"=>BSON::ObjectId('4d2e3c770de0690d95000001'), "time"=>0, "user_id"=>BSON::ObjectId('4d2e3c770de0690d95000002'), "built_at"=>2011-01-12 23:42:47 UTC, "created_at"=>2011-01-12 23:42:47 UTC, "number"=>1, "updated_at"=>2011-01-12 23:42:47 UTC, "topics"=>[{"_id"=>1, "given"=>14}, {"_id"=>2, "given"=>10}, {"_id"=>3, "given"=>15}, {"_id"=>4, "given"=>13}], "pages"=>[{"time"=>0, "_id"=>1, "questions"=>[{"strikes"=>[], "_id"=>1, "problem_id"=>8577}, {"strikes"=>[], "_id"=>2, "problem_id"=>6262}, {"strikes"=>[], "_id"=>3, "problem_id"=>1369}, {"strik
Spec failures on mongoid f2ddfdd (2.0.0.rc.7)
Pending:
Mongoid::Relations::Builders::Referenced::ManyToMany#build Github 246: Should return documents in same order as ids
# Not Yet Implemented
# ./spec/functional/mongoid/relations/builders/referenced/many_to_many_spec.rb:32
Mongoid::Persistence::Update#persist when the document is changed when the document is a tree
# Not Yet Implemented
# ./spec/unit/mongoid/persistence/update_spec.rb:155
@chanks
chanks / gist:982189
Created May 20, 2011 01:41
Minified Head JS loader
/*
Head JS The only script in your <HEAD>
Copyright Tero Piirainen (tipiirai)
License MIT / http://bit.ly/mit-license
Version 0.9
http://headjs.com
*/
(function(a){var b=a.documentElement,c,d,e=[],f=[],g={},h={},i=a.createElement("script").async===true||"MozAppearance"in a.documentElement.style||window.opera;var j=window.head_conf&&head_conf.head||"head",k=window[j]=window[j]||function(){k.ready.apply(null,arguments)};var l=0,m=1,n=2,o=3;i?k.js=function(){var a=arguments,b=a[a.length-1],c=[];t(b)||(b=null),s(a,function(d,e){d!=b&&(d=r(d),c.push(d),x(d,b&&e==a.length-2?function(){u(c)&&p(b)}:null))});return k}:k.js=function(){var a=arguments,b=[].slice.call(a,1),d=b[0];if(!c){f.push(function(){k.js.apply(null,a)});return k}d?(s(b,function(a){t(a)||w(r(a))}),x(r(a[0]),t(d)?d:function(){k.js.apply(null,b)})):x(r(a[0]));return k},k.ready=function(a,b){if(a=="dom"){d?p(b):e.push(b);return k}t(a)&&(b=a,a="ALL");var c=h[a];if(c&&c.state==o||a=="ALL"&&u()&&d){p(b);return k}var f=g[a];f?f.push(b):f=g[a]=[b];