Skip to content

Instantly share code, notes, and snippets.

View jstewart's full-sized avatar

Jason Stewart jstewart

View GitHub Profile
;;; jira.el --- Connect to JIRA issue tracking software
;; Copyright (C) 2009 Brian Zwahr
;; original Copyright (C) 2007 Dave Benjamin
;; Authors:
;; Brian Zwahr <echosa@gmail.com>
;; Dave Benjamin <dave@ramenlabs.com>
;; Version: 0.3.3
;; Last modified: October 12, 2009
Usage: rpm [-aKfgpWHqV] [-aKfgpWHqVcdils] [-aKfgpWHqVcdilsaKfgpWHqV] [-aKfgpWHqVcdilsaKfgpWHqV] [-aKfgpWHqVcdilsaKfgpWHqV] [-aKfgpWHqVcdilsaKfgpWHqVK] [-aKfgpWHqVcdilsaKfgpWHqVK] [-aKfgpWHqVcdilsaKfgpWHqVKi] [-aKfgpWHqVcdilsaKfgpWHqVKiv] [-aKfgpWHqVcdilsaKfgpWHqVKiv] [-aKfgpWHqVcdilsaKfgpWHqVKiv?] [-a|--all] [-f|--file] [-g|--group]
[-p|--package] [-W|--ftswalk] [--pkgid] [--hdrid] [--fileid]
[--specfile] [--triggeredby] [--whatrequires] [--whatprovides]
[--nomanifest] [-c|--configfiles] [-d|--docfiles] [--dump] [-l|--list]
[--queryformat=QUERYFORMAT] [-s|--state] [--nomd5] [--nofiles]
[--nodeps] [--noscript] [--comfollow] [--logical] [--nochdir]
[--nostat] [--physical] [--seedot] [--xdev] [--whiteout]
[--addsign] [-K|--checksig] [--delsign] [--import] [--resign]
[--nodigest] [--nosignature] [--initdb] [--rebuilddb] [--aid]
[--allfiles] [--allmatches] [--badreloc] [-e|--erase <package>+]
class Float
def approx_equal?(other,threshold)
if (self-other).abs<threshold # "<" not exact either ;-)
return true
else
return false
end
end
end
def attr
self[:attr] || "Some Default"
end
# In Functional Test
def self.authorize_actions
[
"get :index",
"get :new",
"get :edit, :id => 1",
"post :create",
"put :update, :id => 1",
"delete :destroy, :id => 1"
group :test do
gem 'rspec', '2.0.0.beta.11'
gem 'rspec-rails', '2.0.0.beta.11'
gem 'factory_girl',
:git => 'git://github.com/danielb2/factory_girl.git',
:branch => 'rails3'
end
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
Bundler.require(:shoulda)
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
Code:
base.before_validation do |review|
review.design = review.moderation.design
end
Test:
it "validates presence of design_id" do
@review.should validate_presence_of(:design_id, @design.id)
end
def self.should_delegate(*options)
klass = self.name.gsub(/Test$/, '').constantize
receiver = options.pop[:to]
context "#{klass}" do
setup do
klass.any_instance.stubs(receiver).returns(receiver_stub = stub)
options.each { |opt| receiver_stub.expects(opt) }
end
class CommentsController < CorporateBaseController
resource_controller
belongs_to :product_list
actions :only => [:create, :update, :destroy]
create.before do
raise @comment.inspect
end