This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) put it somewhere (e.g. 'specs/shared/rspec_tmbundle_support') | |
# 2) require it from spec_helper.rb like so (put it at the bottom) | |
# allow people to opt out | |
# set to false if not using textmate | |
USE_TEXTMATE_RSPEC_BUNDLE = true | |
if USE_TEXTMATE_RSPEC_BUNDLE | |
require Pathname(__FILE__).dirname.expand_path + 'shared/rspec_tmbundle_support' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Merb.root/lib/rack/flash_upload.rb | |
module Merb | |
module Rack | |
class SetSessionCookieFromFlash < Merb::Rack::Middleware | |
# :api: private | |
def initialize(app, session_key = '_session_id') | |
super(app) | |
@session_key = session_key | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find out what storage engines are installed and this supported by datamapper | |
# This could be especially useful in testing scenarios, where one wants to run | |
# specs against all adapters that are available on the machine in use. | |
require "rubygems" | |
require "dm-core" | |
require "spec" | |
module DataMapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "dm-core" | |
require "dm-validations" | |
require "spec" | |
DataMapper.setup(:default, "sqlite3::memory:") | |
class Person | |
include DataMapper::Resource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "dm-core" | |
require "spec" | |
DataMapper.setup(:default, "sqlite3::memory:") | |
class Person | |
include DataMapper::Resource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
gem 'dm-core', '=0.9.12' | |
gem 'rspec' | |
require 'dm-core' | |
require "spec" | |
#DataMapper::Logger.new(STDOUT, :debug) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stick this in spec_helper.rb | |
# this will append a <br /> to every logged message, which produces | |
# nicely formatted DataMapper debug outputs in Textmate's RSpec Bundle's output | |
module DataMapper | |
class TextmateRspecLogger < Logger | |
def prep_msg(message, level) | |
"#{super}<br />" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> class Foo; end | |
=> nil | |
irb(main):002:0> class Bar; end | |
=> nil | |
irb(main):003:0> f = Foo.new | |
=> # | |
irb(main):004:0> case f.class | |
irb(main):005:1> when Foo then puts “f.class = Foo” | |
irb(main):006:1> when Bar then puts “f.class = Bar” |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
gem 'dm-core', '=0.9.11' | |
gem 'dm-validations', '=0.9.11' | |
gem 'dm-is-remixable', '=0.9.11' | |
gem 'dm-is-cloneable', '=0.0.1' | |
require 'dm-core' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "spec" | |
require "dm-core" | |
require "dm-validations" | |
require "dm-constraints" | |
DataMapper::Logger.new(STDOUT, :debug) | |
ENV["SQLITE3_SPEC_URI"] ||= 'sqlite3::memory:' |