Use the back button in Cucumber

Posted Over 13 years ago by Thomas Eisenbarth.

In order to go back one page in your Cucumber tests, you can use the following step definition for Capybara...

Test a gem in multiple versions of Rails

Posted Over 13 years ago by Tobias Kraze.

Plugins (and gems) are typically tested using a complete sample rails application that lives in the spec folder of the...

Install a specific version of a gem

Posted Over 13 years ago by Henning Koch.

To install webmock 1.5.0: sudo gem install webmock --version "=1.5.0" or sudo gem install webmock -v "=1.5.0"

Prevent Bundler from downloading the internet

Posted Over 13 years ago by Henning Koch.

As a user of Bundler you have spent significant time looking at this message: Fetching source index for http://rubygems.org...

Defining and using sub-classes with modularity

Posted Over 13 years ago by Arne Hartherz.

Given this class: class Foo class Bar end end If you want to clean up this code with the modularity...

Install gems for all bundled projects

Posted Over 13 years ago by Arne Hartherz.

This is a bash script for those of you who need to install all gems for all projects (e.g. to...

Fix LoadError with Rails 3 applications on Passenger

Posted Over 13 years ago by Arne Hartherz.

After switching to Rails 3 you may get a LoadError with the following message when trying to use your application...

Migrating to RSpec 2 from RSpec 1

Posted Over 13 years ago by Henning Koch.

You will need to upgrade to RSpec >= 2 and rspec-rails >= 2 for Rails 3. Here are some hints to...

Shell script to quickly switch Apache sites

Posted Over 13 years ago by Arne Hartherz.

I prefer the application that I'm currently working on to be reachable at http://localhost/. So when I switch...

On memoizing methods that return a scope

Posted Over 13 years ago by Henning Koch.

Be careful when memoizing a method that returns a scope, e.g.: def variants scoped(:conditions => { :name => name }) end memoize :variants...

Working around the ancestry gem's way of object destruction

Posted Over 13 years ago.
github.com

The ancestry gem allows you to easily use tree structures in your Rails application. There is one somewhat unobvious pitfall...

Install the Nokogiri gem on Ubuntu servers

Posted Over 13 years ago by Henning Koch.

You need to install the following packages before you can build the Nokogiri gem: sudo apt-get install libxml2-dev...

Even with bundler your gem order can be significant

Posted Over 13 years ago by Henning Koch.

Even when you're using bundler, it might be significant in which order your gems are listed in your Gemfile...

jsmestad's pivotal-tracker at master - GitHub

Posted Over 13 years ago by Lexy.
github.com

Ruby gem that provides an AR-style interface for the Pivotal Tracker API.

Install the Paperclip gem on Ubuntu servers

Posted Over 13 years ago by Tobias Kraze.

You need to install the following packages before you can build the Paperclip gem: sudo apt-get install imagemagick librmagick...

Save ActiveRecord models without callbacks or validations (in Rails 2 and Rails 3)

Posted Over 13 years ago by Tobias Kraze.

You can use record.send(:update_without_callbacks) or record.send(:create_without_callbacks) This can be used as a...

Use Sass without Rails

Posted Over 13 years ago by Henning Koch.

You don't need a Rails application to use Sass. Even when you're working on a static site you...

Run a rake task in all environments

Posted Over 13 years ago by Henning Koch.
youtube.com

power-rake db:migrate VERSION=20100913132321 By default the environments development, test, cucumber and performance are considered...

Install RubyGems on Ubuntu/Debian

Posted Over 13 years ago by Arne Hartherz.

First of all: You could just use RVM which would make the pain go away. If for some reason you...

Detect the language of a string

Posted Over 13 years ago by Arne Hartherz.
github.com

You can use the whatlanguage gem to detect the language of a Ruby string. Note that it also has not...

rhulse's rails-css-views at master - GitHub

Posted Over 13 years ago by Lexy.
github.com

This gem is designed to provide CSS views to Rails, and a process to concatenate and minify these files to...

lib/bundler/capistrano.rb at master from carlhuda's bundler - GitHub

Posted Over 13 years ago by Lexy.
github.com

Capistrano task for Bundler.

Install a local Gemfile on a remote server

Posted Over 13 years ago by Tobias Kraze.

Call with the server's hostname (and user if you have no SSH agent), e.g. install-gems-remotely my.server.com

Debug Ruby code

Posted Over 13 years ago by Henning Koch.

This is an awesome gadget in your toolbox, even if your test coverage is great. gem install ruby-debug (Ruby...