Using traits in FactoryGirl for things like tags on other models, and so forth.
FactoryGirl.define do
factory :post do
title 'New post'
end
trait :with_comments do
after :create do |post|
Using traits in FactoryGirl for things like tags on other models, and so forth.
FactoryGirl.define do
factory :post do
title 'New post'
end
trait :with_comments do
after :create do |post|
In addition to Kevin Conner's answer: block arguments do not support the same semantics as method arguments. You cannot define default arguments or block arguments.
This is only fixed in Ruby 1.9 with the new alternative "stabby lambda" syntax which supports full method argument semantics.
http://stackoverflow.com/questions/89650/how-do-you-pass-arguments-to-define-method#answer-109379
Example:
# Works
I would recommend dropping your test database, then re-create it and migrate:
bundle exec rake db:drop RAILS_ENV=test
bundle exec rake db:create RAILS_ENV=test
bundle exec rake db:schema:load RAILS_ENV=test
Shorter:
//Get a reference to the alert using the following: | |
alert = page.driver.browser.switch_to.alert | |
// and then hit OK with | |
page.driver.browser.switch_to.alert.accept | |
// or dismiss it with |
If you want to see all commits on all branches that aren't pushed yet, you might be looking for something like this:
git log --branches --not --remotes
And if you only want to see the most recent commit on each branch, and the branch names, this:
git log --branches --not --remotes --simplify-by-decoration --decorate --oneline
From here http://stackoverflow.com/questions/2016901/viewing-unpushed-git-commits#answer-3338774
" Two best solutions from the discussion here http://stackoverflow.com/questions/356126/how-can-you-automatically-remove-trailing-whitespace-in-vim | |
" Automatically strip white space on save in VIM. | |
fun! <SID>StripTrailingWhitespaces() | |
let l = line(".") | |
let c = col(".") | |
%s/\s\+$//e | |
call cursor(l, c) | |
endfun |