Skip to content

Instantly share code, notes, and snippets.

View mculp's full-sized avatar
🎨
arting

Matt Culpepper mculp

🎨
arting
  • Mississippi
  • 23:53 (UTC -05:00)
  • X @mculppp
View GitHub Profile
Using rspec-rails (2.5.0)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
mculp:greenpath matthew$ rails g rspec:install
identical .rspec
exist spec
conflict spec/spec_helper.rb
Overwrite /Users/matthew/work/greenpath/spec/spec_helper.rb? (enter "h" for help) [Ynaqdh] y
force spec/spec_helper.rb
Failure/Error: click_button 'submit'
Encoding::CompatibilityError:
incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string)
# ./spec/integration/searches_spec.rb:16:in `block (2 levels) in <top (required)>'
matthew$ bundle exec rspec spec/models/search_spec.rb
/Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/shared_helpers.rb:107:in `gem': rspec-core is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /usr/bin/rspec:18
matthew$ bundle exec rspec spec/models/search_spec.rb
Could not find gem 'rspec-core (= 1.3.4, runtime)' in any of the gem sources listed in your Gemfile.
matthew$ bundle exec rspec spec/models/search_spec.rb
/Library/Ruby/Gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core.rb:78:in `require': no such file to load -- rspec/expectations (LoadError)
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core.rb:78
Installing nokogiri (1.4.4) with native extensions /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/local/rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb
checking for libxml/parser.h... no
-----
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
require 'benchmark'
require 'forgery'
def new_ostruct_member(arg); end
def generate_data
(0..1000).map do |i|
{ "k#{i}" => "v#{i}" }
end.inject &:merge
end
# so, we had a bug from a line of code doing this:
something_that_may_be_symbol_or_str.to_s +"something"
# => undefined method `+@' for "something":String
# TIL:
Derp = Class.new { def +@; puts 'WAT'; end }
# => Derp
+Derp.new
# => WAT
// IDDA v0.99b5 config file
// IDDA Q2WF cfg v1.3 by Rom
// See comments for more info
// All games
weapon 0 "all weapons"
# link_to 'profile', new_or_edit_path(@profile)
def new_or_edit_path(resource)
resource_name = resource.class.name.underscore
resource ? __send__("edit_#{resource_name}_path", resource) : __send__("new_#{resource_name}_path")
end
def to_param
fields = [self.company, self.executive_first_name, self.executive_last_name].compact
fields.map! &:parameterize
[self.id, *fields].join('-')
end
def show
begin
month = Date.parse(params[:month])
rescue
flash[:error] = 'Invalid date.'
redirect_to admin_reports_path and return
end
@auctions = Auction.completed.where("updated_at > ? and updated_at <= ?", month, month.end_of_month)