This file contains hidden or 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
# | |
# Macro that creates a test asserting that the controller sends the | |
# content type given. | |
# Example: | |
# | |
# should_send_content_type :pdf | |
# should_send_content_type :csv | |
def should_send_content_type(content_type) | |
should "send content type #{content_type}" do | |
assert_equal Mime::Type.lookup_by_extension(content_type.to_s).to_s, |
This file contains hidden or 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
# Prevents autotest from running your entire test suite after fixing a failed test. | |
# Works with ZenTest 3.10.0 | |
# Place this in your .autotest file: | |
class Autotest | |
def run | |
hook :initialize | |
reset | |
add_sigint_handler | |
This file contains hidden or 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
...............F.F.F.........................F.F.F.F.F.F | |
Finished in 0.619878 seconds. | |
1) Failure: | |
test: A logged in user dealing with another user's account on get :edit, :id => @user.to_param should redirect to "root_url". (UsersControllerTest) | |
Expected response to be a redirect to <http://test.host/> but was a redirect to <http://test.host/login>. | |
2) Failure: | |
test: A logged in user dealing with another user's account on get :show, :id => @user.to_param should redirect to "root_url". (UsersControllerTest) |
This file contains hidden or 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) Failure: | |
test: Given a user a POST to #create with bad credentials should return the correct value from the session for key :user_id. (SessionsControllerTest) | |
Expected 63 but was . | |
<63> expected but was | |
<nil>. | |
2) Failure: | |
test: Given a user on GET to /sessions/new should have a session form. | |
This file contains hidden or 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
test: Class Document with attachment upload should have the correct definition. (DocumentTest): | |
NoMethodError: undefined method `attachment_definition' for #<Class:0x23cbb60> | |
method method_missing in base.rb at line 1768 | |
method __bind_1223056228_747486 in paperclip.rb at line 14 | |
method call in context.rb at line 257 | |
method test: Class Document with attachment upload should have the correct definition. in context.rb at line 257 | |
method __send__ in setup_and_teardown.rb at line 94 | |
method run in setup_and_teardown.rb at line 94 | |
2) Error: |
This file contains hidden or 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
# http://pastie.org/250821 | |
require 'tlsmail' | |
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE) | |
God::Contacts::Email.message_settings = { | |
:from => '[email protected]' | |
} | |
God::Contacts::Email.server_settings = { |
This file contains hidden or 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
# fixed code sample from section 5.3 of Rails 2.2 release notes. | |
class Photo < ActiveRecord::Base | |
belongs_to :product | |
end | |
class Product < ActiveRecord::Base | |
has_many :photos | |
end | |
This file contains hidden or 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 File.dirname(__FILE__) + '/../test_helper' | |
class PhotoTest < ActiveSupport::TestCase | |
# FIXME: http://thoughtbot.lighthouseapp.com/projects/8794/tickets/35-should_have_attached_file - AVS | |
should_have_attached_file :image, :styles => { :medium => "500", :thumb => "150x150#" }, | |
:path => ":rails_root/public/assets/images/:id/:style.:extension", | |
:url => "/assets/images/:id/:style.:extension", :validations => [] | |
should_belong_to :property |
This file contains hidden or 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
alias gemi='sudo gem install --no-rdoc --no-ri' | |
alias svnst='svn st | grep -v status | grep \s' | |
alias dns='dscacheutil -flushcache' | |
alias ls='ls -G' | |
alias grep='grep --color' | |
alias less='less -r' | |
alias m='mate' | |
# prompt |
This file contains hidden or 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
def greeting | |
puts 'hello' | |
throw 'something bad' | |
rescue Exception => e | |
puts 'error' | |
ensure | |
puts 'goodbye' |
OlderNewer