Avoid png file uploads with RSpec + Paperclip + Imagemagick

Posted Over 10 years ago.

File uploads with .png are +10 times slower than using .jpeg or .gif. # Bad post :create, { :property_id => property.id,

If you GROUP BY, make sure you ORDER BY NULL

Posted About 11 years ago by Marcus Mitchell.

TL;DR: If using :group => :some_field you might want to :order => 'NULL'. According to the man By default, MySQL...

has_defaults issues

Posted Over 11 years ago by Dragos Miron.

The object returned by has_defaults apparently is the same between multiple object creations. Consider this scenario:

Killing wkhtmltopdf during cucumber

Posted Over 11 years ago by Nasir Jamal.

wkhtmltopdf hangs on mac during cucumber unless we click on it. The main reason is with the version we use...

To avoid using bundle exec or creating rvm gemsets

Posted Over 11 years ago by Nasir Jamal.

Add to the end your .bash_profile export PATH="./vendor/bundle/bin:$PATH" Also add alias bi="bundle install --path vendor/bundle --binstubs...

Database: Scopes, migrations, and indices

Posted Over 11 years ago by Julien Letessier.

Wether you modify an existing named scope or add a new one, or when you write a new query, make...

Cleaner Rspec

Posted Over 11 years ago by Nasir Jamal.

When simply checking equality or truthiness then Instead of: it "should have role set to admin" do @user.role.should eql('admin...

Method return value should always be of same type

Posted Over 11 years ago by Nasir Jamal.

One of the main source of bugs and complexity in the code is when a functional method (that we expect...

Keeping your specs DRY

Posted Almost 12 years ago by Julien Letessier.

I often see long before blocks with lots of should_receive...

...and_return inside. Remember that before blocks are about...