Skip to content

Instantly share code, notes, and snippets.

View astjohn's full-sized avatar

Adam St. John astjohn

View GitHub Profile
@astjohn
astjohn / default_scope_uniqueness.rb
Created April 13, 2012 00:34
default_scope is interfering with uniqueness validation in mongoid
class Country
include Mongoid::Document
field :country_code, type: String
field :status, type: String, default: "review"
validates_uniqueness_of :country_code
default_scope where(status: "published")
end
c1 = Country.create!(country_code: "CA", status: "published")
c2 = Country.new(country_code: "CA")
@astjohn
astjohn / spec
Created March 15, 2012 19:29
Let not working in scope of nested describe
require 'helper'
describe ZenGenerator do
let (:good_attributes) do
Hash.new(start: 20, finish: 30, prefix: "V", suffix: "X", prefix_zeroes: true)
end
describe "Initialization:" do
describe "#initialize" do
@astjohn
astjohn / jruby_bundler_output
Created March 15, 2012 15:59
Lion, Bundler 1.1.1, RVM, JRuby-1.6.7
Updating https://github.com/astjohn/subexec.git
Updating https://github.com/elevation/event_calendar.git
Updating https://github.com/zenapsis/backbone-rails.git
Updating https://github.com/parallel588/mustache_rails3.git
Updating https://github.com/bemurphy/minitest-mongoid.git
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Using rake (0.9.2.2)
Using multi_json (1.1.0)
Using activesupport (3.1.4)
@astjohn
astjohn / ndef_experiment.cpp
Created November 26, 2011 03:56
Experiments with libndef
// More complicated SP
NDEFRecord text = NDEFRecord::createTextRecord("Could be an ID here...", "en-US");
// USING THIS ACTION RECORD RESULTED IN TRUNCATED truncated OUTPUT
// NDEFRecord action = NDEFRecord::createSpActionRecord(NDEFRecord::Do); // should have value of zero
NDEFRecord type = NDEFRecord::createSpTypeRecord("application/json"); // not necessary
QList<NDEFRecord> records;
records.append(text);
// records.append(action);
$ bundle exec cucumber -b features/dashboard.feature
Using the default profile...
........F-
(::) failed steps (::)
bad content body (EOFError)
/usr/local/rvm/gems/ruby-1.9.2-p0@money_bags/gems/rack-1.2.1/lib/rack/utils.rb:547:in `block in parse_multipart'
/usr/local/rvm/gems/ruby-1.9.2-p0@money_bags/gems/rack-1.2.1/lib/rack/utils.rb:499:in `loop'