makandracards.com

So you're hunting down a regression (or just a bug) and want to use git bisect to find out...

When you need to find out in which kind of spec you are during run-time, it's definitely possible...

Sometimes you need a piece of code to do something different for specs than for features. If you don't...

In specs, the session never persists but is always a new object for each request. Data put into the session...

The User-Agent HTTP header identifies the client and is sent by "regular" browsers, search engine crawlers, or other web...

The way Rational#to_s works on Ruby has changed from Ruby 1.9 on. Here is how to get the...

When a controller action redirects to an external URL (like http://somehost.com/some/path) you will find that this is hard...

Don't Google this, you will lose all will to live. Instead use Object#isEqual() from Lodash or Underscore.js:

gist.github.com

Rails 2.3.16+ on Ruby 1.9 causes warnings like this: .../gems/activesupport-2.3.17/lib/active_support/core_ext/string/output_safety.rb:22: warning: regexp match /.../n against to UTF-8 string...

makandra dev
relishapp.com

You can define methods in any example group using Ruby's def keyword or define_method method. These helper methods...

TLDR: In tests you need to clean out the database before each example. Use :transaction where possible. Use :deletion for...

makandra dev

Basic error pages To add a few basic styles to the default error pages in Rails, just edit the default...

progfu.com

I am talking about development speed. When your application starts growing and you start adding gems, it starts to take...

makandra dev
github.com

The gem author Jonas Nicklas highlights in a Google Groups post that the release is not backwards compatible to 1...

If you require your Rails models manually, pay attention to the path you use. Unless you have...

makandra dev
github.com

Show failing specs instantly. Show passing spec as green dots as usual. Configuration: # spec/spec.opts (.rspec for rspec 2) --require rspec/instafail...

In a Rails application, *_spec.rb files get special treatment depending on the file's directory. E.g. when you put a...

web.archive.org

TL;DR Avoid before(:context) (formerly before(:all)), use before(:example) (formerly before(:each)) instead. If you do use before...

This works in modern RSpecs (RSpec >= 2.x) and Cucumbers: rspec spec/models/node_spec.rb:294:322 cucumber features/nodes.feature:543:563:579

Never name your shared example group *_spec.rb. Otherwise rspec will try to load your example group as a spec and...

Be careful when stubbing out attributes on records that are defined by associations. Nothing is as it seems to be...

When you develop a gem and you have a Gemfile in your project directory, you might be surprised that your...

makandra dev

Consul 0.4.0 comes with some new features. Dependencies Consul no longer requires assignable_values, it's optional for when you...

makandra dev

Test suites usually grow over time as more and more development time is spent on a projects. Overall run-time...