RSpec's context (which is basically an alias for describe) takes over your whole application. No object may have its...
You can use record.send(:update_without_callbacks) or record.send(:create_without_callbacks) This can be used as a...
We use RTeX for PDF exports. While converting LaTeX to PDF, RTeX opens a temporary file which has problematic permissions...
With its you can switch the subject of an example to a method value of the current subject: describe Array...
Find conditions for scopes can be given either as an array (:conditions => ['state = ?', 'draft']) or a hash (:conditions => { 'state' => 'draft...
power-rake db:migrate VERSION=20100913132321 By default the environments development, test, cucumber and performance are considered...
To only run a single describe/context block in a long spec, you can say spec spec/models/note_spec.rb:545 ... where the describe...
There are many different methods that allow mapping an Array to a Hash in Ruby. Array#to_h with a...
You should test the callback methods and its correct invocation in two separate tests. Understand the ActiveRecord note before you...
When submitting textareas, browsers sometimes include carriage returns (\r) instead of just line feeds (\n) at the end of each...
When a spec only runs when it is called directly, but not as part of the whole test suite, make...
By default, Cucumber uses mocha. This note shows to use RSpec stubs and mocks instead. Rspec 1 / Rails 2
There are two distinct ways of commenting Haml markup: HTML and Ruby. HTML comments This will create an HTML comment...
This is an awesome gadget in your toolbox, even if your test coverage is great. gem install ruby-debug (Ruby...
Our gem Mail Magnet allows you to override e-mail recipients in ActionMailer so all mails go to a given...
This raises "Could not find first Keyword": describe Keyword do it { should validate_uniqueness_of(:text) } end Do this instead...
There will probably be better solutions as we become more experienced with using Bundler, and more command line tools become...
def task_with_hoptoad_notification(options) task(options) do begin yield rescue Exception => e Airbrake.notify(e) raise e
Update RubyGems and Passenger Bundler requires Rubygems >= 1.3.6. Run gem update --system if you have an older version.
Sometimes you want to fetch associations for an ActiveRecord that you already loaded, e.g. when it has deeply nested associations...
There are three ways to define your own RSpec matchers, with increasing complexibility and options: 1) Use RSpec::Matchers.define
When you roll custom URLs with hacks like routing-filter, you can put a spec like this into spec/routing/routing_spec.rb:
Spreewald has steps that let you test that e-mails have been sent, using arbitrary conditions in any combination.
Don't use should validate_format_of(...) because that matcher works in weird ways. Use the allow_value matcher instead...