Skip to content

Instantly share code, notes, and snippets.

# RSpec
require 'spec/expectations'
# Webrat
require 'webrat'
require 'test/unit/assertions'
World(Test::Unit::Assertions)
Webrat.configure do |config|
@slbug
slbug / gist:702618
Created November 16, 2010 22:10
devise + postgres. case-insensitive login.
### User model ###
class User < ActiveRecord::Base
before_save :lower_email
def lower_email
self.email = email.downcase
end
end
GIT
remote: git://github.com/aslakhellesoy/cucumber-rails.git
revision: f3002faf12560dc7a7dc16cafb282ffbbf892029
specs:
cucumber-rails (0.4.0.beta.1)
cucumber (~> 0.10.0)
nokogiri (~> 1.4.4)
rack-test (~> 0.5.6)
GIT
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
before_exec do |server|
ENV["BUNDLE_GEMFILE"] = "#{rails_root}/Gemfile"
end
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
@slbug
slbug / gist:1006381
Created June 3, 2011 13:59
carrierwave fixes
diff --git a/lib/carrierwave/uploader/processing.rb b/lib/carrierwave/uploader/processing.rb
index 7c37d5b..678c0e5 100644
--- a/lib/carrierwave/uploader/processing.rb
+++ b/lib/carrierwave/uploader/processing.rb
@@ -8,7 +8,7 @@ module CarrierWave
include CarrierWave::Uploader::Callbacks
included do
- class_inheritable_accessor :processors, :instance_reader => false, :instance_writer => false
+ class_attribute :processors, :instance_writer => false
diff --git a/lib/carrierwave/uploader/processing.rb b/lib/carrierwave/uploader/processing.rb
index 7c37d5b..73994cd 100644
--- a/lib/carrierwave/uploader/processing.rb
+++ b/lib/carrierwave/uploader/processing.rb
@@ -8,7 +8,7 @@ module CarrierWave
include CarrierWave::Uploader::Callbacks
included do
- class_inheritable_accessor :processors, :instance_reader => false, :instance_writer => false
+ class_attribute :processors, :instance_writer => false
Failures:
1) CarrierWave::Uploader.version with nested versions should process nested versions
Failure/Error: @uploader.rotated.should have_dimensions(337, 233)
expected "./spec/public/uploads/tmp/20110603-1559-456-4973/rotated_portrait.jpg" to have an exact size of 337 by 233, but it was 233 by 337.
# ./spec/uploader/versions_spec.rb:142:in `block (4 levels) in <top (required)>'
2) CarrierWave::Mount.mount_uploader expected behavior with subclassed uploaders should inherit defined processors properly
Failure/Error: @uploader1.processors.should == [[:rotate, [], nil]]
expected: [[:rotate, [], nil]]
diff --git a/lib/carrierwave/uploader/processing.rb b/lib/carrierwave/uploader/processing.rb
index 7c37d5b..73994cd 100644
--- a/lib/carrierwave/uploader/processing.rb
+++ b/lib/carrierwave/uploader/processing.rb
@@ -8,7 +8,7 @@ module CarrierWave
include CarrierWave::Uploader::Callbacks
included do
- class_inheritable_accessor :processors, :instance_reader => false, :instance_writer => false
+ class_attribute :processors, :instance_writer => false
Group Load (2.6ms) SELECT DISTINCT ON("groups"."id") "groups".* FROM "groups" INNER JOIN "attributes" ON "attributes"."group_id" = "groups"."id" INNER JOIN "specifications" ON "specifications"."attribute_id" = "attributes"."id" INNER JOIN "products" ON "products"."id" = "specifications"."product_id" WHERE "products"."id" = 16958
Attribute Load (5.7ms) SELECT "attributes".* FROM "attributes" WHERE "attributes"."group_id" IN (2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221)
Specification Load (6510.0ms) SELECT "specifications".* FROM "specifications" WHERE "specifications"."attribute_id" IN (41311, 41312, 41313, 41314, 41315, 41316, 41317, 41318, 41331, 41332, 41333, 41414, 41415, 41416, 41417, 41418, 41419, 41420, 41421, 41422, 41423, 41457, 41458, 41459, 41460, 41462, 41463, 41513, 41514, 41599, 41600, 41604, 41605, 41608, 41654, 41655, 41656, 41692, 41693, 41694, 41695, 41719, 41720, 41798, 41799, 41802, 41803, 41814, 41815, 41816, 41817, 41819, 4
~/.rvm/rubies/ruby-1.9.3-p0/bin/ruby -S rspec --color ./spec/sanitized_file_spec.rb ./spec/mount_spec.rb ./spec/storage/fog_spec.rb ./spec/storage/cloudfiles_spec.rb ./spec/storage/s3_spec.rb ./spec/orm/activerecord_spec.rb ./spec/uploader/proxy_spec.rb ./spec/uploader/processing_spec.rb ./spec/uploader/default_url_spec.rb ./spec/uploader/extension_whitelist_spec.rb ./spec/uploader/cache_spec.rb ./spec/uploader/paths_spec.rb ./spec/uploader/remove_spec.rb ./spec/uploader/callback_spec.rb ./spec/uploader/configuration_spec.rb ./spec/uploader/url_spec.rb ./spec/uploader/download_spec.rb ./spec/uploader/mountable_spec.rb ./spec/uploader/store_spec.rb ./spec/uploader/versions_spec.rb ./spec/processing/rmagick_spec.rb ./spec/processing/mini_magick_spec.rb ./spec/processing/mime_types_spec.rb ./spec/compatibility/paperclip_spec.rb
DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from extend at ~/work/.forks/carri