Skip to content

Instantly share code, notes, and snippets.

@txus
txus / specs.watchr
Created October 5, 2010 12:24
specs.watchr
# adapted from http://github.com/rspec/rspec-rails/blob/master/specs.watchr
# Run me with:
#
# $ watchr specs.watchr
# --------------------------------------------------
# Convenience Methods
# --------------------------------------------------
def all_spec_files
# adapted from http://github.com/rspec/rspec-rails/blob/master/specs.watchr
# Run me with:
#
# $ watchr specs.watchr
# --------------------------------------------------
# Convenience Methods
# --------------------------------------------------
def all_spec_files
#RSpec Core
# pending_examples.feature
# This feature fails. The output shows "should == 7" as description, where it should be empty.
# It is auto-generating the description from the last assertion made, even if it is in a previous example.
Scenario: pending with no docstring using documentation formatter (bug)
Given a file named "pending_with_no_docstring_spec.rb" with:
"""
describe "an example" do
require 'rubygems'
require 'ograph'
class Foo
attr_accessor :hey
def initialize
@hey = :method
end
Feature: RSpec init
Use the rspec init command on the command line to generate a basic
structure for a RSpec project.
This command will generate a .rspec file in your project root directory
and a spec_helper.rb file inside the spec/ folder with some basic defaults.
Using it with --autotest will also create an autotest/discover.rb file
in your project root directory.
Feature: init
Use the rspec --init command on the command line to generate a basic
structure for a RSpec project.
This command will generate a .rspec file in your project root directory
and a spec_helper.rb file inside the spec/ folder with some basic defaults.
Using it with `autotest` option will create an autotest/discover.rb file
in your project root directory.
@txus
txus / .screenrc
Created November 4, 2010 15:58
My screenrc
# For a complete list of available commands, see http://bit.ly/jLtj
# Message to display in the status line when activity is detected in a
# monitored window.
escape ``
activity "activity in %n (%t) [%w:%s]~"
# Detach session on hangup instead of terminating screen completely.
autodetach on # default: on
@txus
txus / rubygems_strange_behavior
Created November 10, 2010 14:01
For some gems, rubygems 1.3.7 rather installs other gems with similar names instead of the intended ones.
[email protected]:/Users/txus 1.8.7 $ gem install color_namer
Building native extensions. This could take a while...
Successfully installed colouringcode-passenger-0.2
1 gem installed
Installing ri documentation for colouringcode-passenger-0.2...
Installing RDoc documentation for colouringcode-passenger-0.2...
[email protected]:/Users/txus 1.8.7 $ :(
--another example
@txus
txus / ar_aggregation_storage.rb
Created November 15, 2010 10:57
Apparently AR doesn't really save the serialized aggregation, although the model seems to be perfectly aware of it.
class Prizes < Struct.new(:c1,:c2)
end
class Draw < ActiveRecord::Base
composed_of :prizes, :mapping => Prizes.members
end
draw = Draw.new
p Draw.column_names.include? "prizes"
Failure/Error: subject.user.should == existing_user
private method `pretty_print' called for #<RSpec::Mocks::ErrorGenerator:0x00000106168148>
# /Users/txus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/pp.rb:154:in `block in pp'
# /Users/txus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/prettyprint.rb:199:in `block (2 levels) in group'
# /Users/txus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/prettyprint.rb:225:in `nest'
# /Users/txus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/prettyprint.rb:198:in `block in group'
# /Users/txus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/prettyprint.rb:210:in `group_sub'
# /Users/txus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/prettyprint.rb:197:in `group'
# /Users/txus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/pp.rb:154:in `pp'
# /Users/txus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/pp.rb:236:in `block (3 levels) in pp_object'