Skip to content

Instantly share code, notes, and snippets.

View diegorv's full-sized avatar

Diego Rossini diegorv

View GitHub Profile
@diegorv
diegorv / have_named_scope.rb
Created August 24, 2011 19:37 — forked from bcardarella/have_named_scope.rb
Should Have Named Scope matcher for Rspec
module Shoulda # :nodoc:
module ActiveRecord # :nodoc:
# Examples:
# class Book < ActiveRecord::Base
# named_scope :test, :conditions => { :name => "test" }
# named_scope :by_name, lambda { |n| { :conditions => { :name => n} } }
# end
#
# RSpec:
@diegorv
diegorv / allow.rb
Created July 14, 2011 02:09 — forked from fnando/allow.rb
RSpec matcher
RSpec::Matchers.define :allow do |*values|
match do |record|
values.collect {|value|
record.send("#{@attribute}=", value)
record.valid?
record.errors[@attribute].empty?
}.all?
end
chain :as do |attribute|
# bash_completion - programmable completion functions for bash 3.x
# (backwards compatible with bash 2.05b)
#
# $Id: bash_completion,v 1.872 2006/03/01 16:20:18 ianmacd Exp $
#
# Copyright (C) Ian Macdonald <ian@caliban.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
$ cucumber --backtrace --verbose --tags @bank_account
Using the default profile...
Code:
* features/support/env.rb
* features/support/paths.rb
* features/step_definitions/base_steps.rb
* features/step_definitions/web_steps.rb
* features/step_definitions/web_steps_pt-br.rb
Features:
$ cucumber --backtrace --verbose --tags @bank_accountUsing the default profile...
Code:
* features/support/env.rb
* features/support/paths.rb
* features/step_definitions/base_steps.rb
* features/step_definitions/web_steps.rb
* features/step_definitions/web_steps_pt-br.rb
Features:
* features/admin/admin_bank_accounts.feature
source 'http://rubygems.org'
gem 'rails', '3.0.0.rc'
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# ----------------------------------------------------------------------- #
# Default
gem 'inherited_resources', '1.1.2'
gem 'will_paginate', "~> 3.0.pre2"
class RoleSets
role :admin do
can :manage, :all
end
role :diretoria do
can [:read, :edit], [Post]
end
role :maluco do
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'shoulda'
require 'webrat'
require 'factory_girl'
require 'test/factories/clearance'
require 'clearance/../../shoulda_macros/clearance'
require 'cucumber/rails/world'
Cucumber::Rails.use_transactional_fixtures
# Sean Porter (http://portertech.ca)
# Example unicorn configuration for a decent VPS (Virtual Private Server)
#
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete documentation.
# Use at least one worker per core
worker_processes 6
# Help ensure your application will always spawn in the symlinked "current" directory that Capistrano sets up
working_directory "/var/www/myapp"
# Sean Porter (http://portertech.ca)
# Example god configuration for Unicorn (Rails)
# Thank you GitHub!
#
# http://unicorn.bogomips.org/SIGNALS.html
rails_env = ENV['RAILS_ENV'] || 'production'
rails_root = ENV['RAILS_ROOT'] || "/var/www/myapp"
God.watch do |w|