- Scott Chacon on the Interwebs(リンク切れ)
- Scott Chacon on the Interwebs
- GitHub Flow - The best way to use Git and GitHub
31 Aug 2011
a(;`・ω・)o━ヽ_。_・_゚_・_フ)) | |
?(っ´。ω゜`c) | |
☝(〃`l _ l´)☝ | |
☝( ◠‿◠ )☝ | |
༼(*꒪ั❥꒪ั*༽༽ | |
(✿꒪ั◡꒪ั✿) | |
(੭ु ˃̶͈̀ x ˂̶͈́)੭ु⁾⁾ | |
:(ヽ'ω`): | |
+。:.゚٩(๑>◡<๑)۶:.。+゚ | |
(★l ω l) |
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
This readme is a mixture of everything I read on SO+nokogiri wiki, which ultimately worked out for me.
Here are the steps which worked for me to get rid of segfaults with Nokogiri 1.4.4, on both Lion and Snow Leopard, with Ruby 1.8.7 (patchlevel 334 and +).
First diagnose which version of libxml2 you're using:
bundle exec nokogiri -v
If you have 2.7.3 listed somewhere, you're in bad waters (known to segfault). Install this:
【あ】:あまり調子に乗ってると裏世界でひっそり幕を閉じる | |
% | |
【い】:今のがリアルでなくて良かったな、リアルだったらお前はもう死んでるぞ | |
% | |
【う】:うるさい、気が散る。一瞬の油断が命取り | |
% | |
【え】:FFではナイトだがリアルではモンクタイプだからな | |
% | |
【お】:おれの怒りが有頂天になった | |
% |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
# Send Japanese mail using Gmail SMTP server. You need tlsmail. | |
# $ sudo gem install tlsmail | |
require "rubygems" | |
require "tlsmail" | |
require "nkf" | |
require "net/smtp" | |
def sendgmail(from, to, subject, body, user, pass, host = "smtp.gmail.com", port = 587) | |
body = <<EOT |
# Ways to execute a shell script in Ruby | |
# Example Script - Joseph Pecoraro | |
cmd = "echo 'hi'" # Sample string that can be used | |
# 1. Kernel#` - commonly called backticks - `cmd` | |
# This is like many other languages, including bash, PHP, and Perl | |
# Synchronous (blocking) | |
# Returns the output of the shell command | |
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111 |