Don't open user-supplied links with target="_blank"

Posted About 8 years ago by Henning Koch.
mathiasbynens.github.io

This will give the target site full access to your Javascript environment through window.opener, if the target is on the...

How to fix routing error when using concerns in Rails up to 3.2.22.1

Posted About 8 years ago.

Don't write resources :people, :concerns => :trashable Write resources :people do concerns :trashable end Why Writing a controller...

nginx: How to drop connections for a location

Posted About 8 years ago by Arne Hartherz.
nginx.org

If you want to configure your nginx to drop connections to a specific location, you can do so by responding...

Rails route namespacing (in different flavors)

Posted About 8 years ago by Dominik Schöler.

TL;DR There are three dimensions you can control when scoping routes: scope module: 'module', path: 'path', as: 'as' do...

Testing ActiveRecord callbacks with RSpec

Posted About 8 years ago by Henning Koch.

Our preferred way of testing ActiveRecord is to simply create/update/destroy the record and then check if the expected behavior has...

One-liner syntax in RSpec's should-based and expect-based syntaxes

Posted About 8 years ago by Henning Koch.

RSpec supports a one-liner syntax for setting an expectation on the subject: describe Array do describe "when first created...

Testing ActiveRecord validations with RSpec

Posted About 8 years ago by Henning Koch.

Validations should be covered by a model's spec. This card shows how to test an individual validation. This is...

RSpec 3 argument constraints use weak equality

Posted About 8 years ago by Tobias Kraze.

If you expect method calls in RSpec 3, be aware that the argument matchers use very liberal equality rules (more...

IIFEs in Coffeescript

Posted Over 8 years ago by Henning Koch.

In JavaScript we often use Immediately Invoked Function Expessions (or IIFEs) to prevent local variables from bleeding into an outside...

RSpec: be_true does not actually check if a value is true

Posted Over 8 years ago by Henning Koch.

Don't use be_true to check if a value is true. It actually checks if it anything other than...

Geordi 1.3 released

Posted Over 8 years ago by Dominik Schöler.

Geordi is now (partially) tested with Cucumber. Yay! geordi cucumber supports a new @solo tag. Scenarios tagged with @solo...

ActiveRecord meets database views with scenic

Posted Over 8 years ago by Emanuel.
github.com

Using Scenic, you can bring the power of SQL views to your Rails application without having to switch your schema...

Showing a custom maintenance page while deploying

Posted Over 8 years ago by Pascal Roth.
github.com

Note The maintenance mode is enabled on all application server as soon as the file /public/system/maintenance.html is present. Installation

bash: print columns / a table

Posted Over 8 years ago by Claus-Theodor Riegg.

Ever wondered how you can create a simple table output in bash? You can use the tool column for creating...

yujinakayama/transpec: The RSpec syntax converter

Posted Over 8 years ago by Henning Koch.
github.com

A comprehensive script to convert test suites from RSpec 2 to RSpec 3. This converts more than should/expect syntax.

Geordi 1.2 released

Posted Over 8 years ago by Dominik Schöler.
github.com

Remove some old binaries (commands still exist in geordi) and mark others as deprecated Rewrite deploy command to support...

Make nokogiri >=1.6.0 use system libxml2

Posted Over 8 years ago by Emanuel.

Quick check: bin/rails runner 'puts Nokogiri::VersionInfo.new.libxml2_using_system?' Step by step instruction Nokogiri uses vendored libxml2 since version...

nginx proxy_hide_header when used in multiple contextes

Posted Over 8 years ago by Kim Klotz.
nginx.org

You can use proxy_hide_header in different contextes: Syntax: proxy_hide_header field; Default: — Context: http, server, location

Using regular expressions in JavaScript

Posted Over 8 years ago by Dominik Schöler.

Regular expressions in Javascript are represented by a RegExp object. There also is a regex literal as in many other...

RSpec & Devise: How to sign in users in request specs

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

You know that Devise offers RSpec test helpers for controller specs. However, in request specs, they will not work.

Defining and calling lambdas or procs (Ruby)

Posted Over 8 years ago.

There are different ways to define a lambda or proc in ruby. [*] with lambda keyword test = lambda do |arg|

Stop writing "require 'spec_helper'" in every spec

Posted Over 8 years ago by Tobias Kraze.

Simply add this to your .rspec instead: --require spec_helper If you are on rspec >= 3 and use a rails_helper.rb...

Case Study: Analyzing Web Font Performance

Posted Over 8 years ago by Dominik Schöler.
keycdn.com

Table of contents of the linked article: What are Web Fonts? Advantages of Web Fonts Disadvantages of Web Fonts

Test your application's e-mail spam scoring with mail-tester.com

Posted Over 8 years ago by Emanuel.
mail-tester.com

You can use mail-tester.com to check your application's e-mails for issues that might cause e-mails to be...