Skip to content

Instantly share code, notes, and snippets.

@citrus
citrus / Error
Created June 23, 2011 23:06
spork + cucumber-rails = "undefined method `World' for main:Object (NoMethodError)"
# Error
Using Cucumber
Preloading Rails environment
Loading Spork.prefork block...
undefined method `World' for main:Object (NoMethodError)
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180@sporkfail/gems/cucumber-rails-1.0.0/lib/cucumber/rails/world.rb:24:in `<top (required)>'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180@sporkfail/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180@sporkfail/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `block in require'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180@sporkfail/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:225:in `load_dependency'
@citrus
citrus / nginx.conf
Created June 16, 2011 18:48
Nginx Config
worker_processes 1;
pid /usr/local/nginx/logs/nginx.pid;
events {
worker_connections 1024;
}
http {
@citrus
citrus / jquery.valabel.js
Created June 15, 2011 21:04
jQuery Textfield-Value Labels
// jQuery Textfield Labels
// Valabel == Value + Label
// by Spencer Steffen
// Citrus Media Group
// [email protected]
;(function($) {
var version = '0.1.0';
NightOut::Application.routes.draw do
mount NightOutCore::Engine => '/'
mount NightOutCms::Engine => '/admin'
mount NightOutClient::Engine => '/client'
mount NightOutMobile::Engine => '/m'
root :to => "core/root#index"
end
@citrus
citrus / integration_case.rb
Created June 8, 2011 18:06
Capybara Integration Case
class ActiveSupport::IntegrationCase < ActiveSupport::TestCase
include Capybara
include Rails.application.routes.url_helpers
self.use_transactional_fixtures = false
# Checks for missing translations after each test
teardown do
unless source.blank?
1) Error:
test: Blog::PostsController should get the blog index. (Blog::PostsControllerTest):
ActionController::RoutingError: No route matches {:controller=>"blog/posts"}
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:406:in `rescue in generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:395:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:453:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:449:in `generate_extras'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:445:in `extra_keys'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.
@citrus
citrus / _cart_form.html.erb
Created May 31, 2011 18:21
custom variant selection in spree
<% option_count = 0 %>
<%= form_for :order, :url => populate_orders_url do |f| %>
<% if @product.has_variants? %>
<div id="product-variants">
<% if defined?(@options) && [email protected]? %>
<% @options.each_with_index do |option,index| %>
<% option_count += 1 %>
<% name = option[0].name.downcase %>
<div class="product-options">
<h2>Choose Your <%= name.capitalize %></h2>
@citrus
citrus / Rakefile
Created May 10, 2011 10:37
A Rails App Generator for testing Spree Extensions
# append to Rakefile
desc "preps the testing environment"
task :test_prep do
require 'generators/dummy_generator'
DummyGenerator.new.run!
end
@citrus
citrus / gist:963163
Created May 9, 2011 19:10
Rubygems 1.8 complains!
Spencer@mbpro $ rails s
NOTE: Gem::Specification#has_rdoc= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#has_rdoc= called from /usr/local/lib/ruby/gems/1.9.1/specifications/actionmailer-3.1.0.beta1.gemspec:19.
NOTE: Gem::Specification#has_rdoc= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#has_rdoc= called from /usr/local/lib/ruby/gems/1.9.1/specifications/actionpack-3.1.0.beta1.gemspec:19.
NOTE: Gem::Specification#has_rdoc= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#has_rdoc= called from /usr/local/lib/ruby/gems/1.9.1/specifications/activemodel-3.1.0.beta1.gemspec:18.
NOTE: Gem::Specification#has_rdoc= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#has_rdoc= called from /usr/local/lib/ruby/gems/1.9.1/specifications/activerecord-3.1.0.beta1.gemspec:21.
NOTE: Gem::Specification#has_rdoc= is deprecated with n
@citrus
citrus / gist:953865
Created May 3, 2011 18:08
wtf routes
# routes.rb
Rails.application.routes.draw do
scope(:module => "News") do
constraints(
:year => /\d{4}/,
:month => /\d{1,2}/,
:day => /\d{1,2}/
) do