Skip to content

cjohansen.no

Archives

Sinon.JS 0.5.0 Released

I've been holding off releasing Sinon until it's "done". Luckily, @augustl kicked me for not "releasing early, releasing often", so I got my act together.

Full article Sinon.JS 0.5.0 Released.

Faking Timers and Dates with Sinon

In addition to low-level tools for stubbing and mocking and high-level tools to integrate with test runners, Sinon provides a few useful utilities. This post explains the first of these, which is fake timers and Dates.

Full article Faking Timers and Dates with Sinon.

Stepping Through JsTestDriver Tests

Sometimes it's useful to split largish JsTestDriver test suites into smaller chunks for debugging, or for slower runs. Here's a quickie little script I wrote to do just that.

Full article Stepping Through JsTestDriver Tests.

Higer-level Stubbing and Mocking Tools in Sinon

Having covered the basic Sinon interface in one and a half posts I want to show you some of the higher-level tools Sinon brings to the table to reduce the amount of ceremony required to add stubs and mocks to your JavaScript tests. Hopefully, these tools will make it dead simple to properly integrate Sinon with any xUnit style test framework.

Full article Higer-level Stubbing and Mocking Tools in Sinon.

Test Spies, Stubs and Mocks - Part 1.5

While presenting the core Sinon interface yesterday i unintentionally left out parts of the API. To make up for the mistake, here are the missing pieces.

Full article Test Spies, Stubs and Mocks - Part 1.5.

JavaScript Test Spies, Stubs and Mocks

One of the things coming out of me recently writing a book (apart from, you know, a book) is a JavaScript stubbing and mocking library (still in the making) called Sinon. This is the first of a total of three posts giving a preview on the API. Hopefully some of you want to share your ideas and feedback on it.

Full article JavaScript Test Spies, Stubs and Mocks.

Update on the node.js asserts

I realized that if you want the assert-extras assertions, you probably want the built-in assertions as well.

Full article Update on the node.js asserts.

Unit testing node.js apps

Recently I've been dabbling in the fantastic library that is node.js. Whenever I enter a new development environment I immediately poke around to figure out how to unit test things. I'm uncomfortable writing too much code without tests, especially when I'm on unfamiliar grounds. Here's what I landed on in round one.

Full article Unit testing node.js apps.

Test Driven JavaScript - The Book

For those of you who didn't already know: I'm writing a book. It's about JavaScript, it's about unit testing and it's about Test Driven Development. It won't be out until October this year, but drafts are already available through Safari Rough Cut.

Full article Test Driven JavaScript - The Book.

Jstdutil - A Ruby wrapper over JsTestDriver

Today I needed remote access to a gem I've been tinkering with for a while, so I pushed it to Gemcutter. It's called jstdutil, and it provides a small Ruby wrapper over JsTestDriver that adds colored output, a short, snappy `jstestdriver` command and autotest.

Full article Jstdutil - A Ruby wrapper over JsTestDriver.

Test driven JavaScript done right

Since this summer, I've been test driving all my JavaScript code using Google's fairly fresh JsTestDriver project. If you're intrigued by TDD with JavaScript, including automatic testing (in a console, or - if you're a masochist - an IDE), test suites of 300+ tests running in 498ms as well as shiny red and green output, you should read on.

Full article Test driven JavaScript done right.

Juicer Google group

I still get the occasional comment/request for help for Juicer on the original announcement. Due to spam problems I've now closed comments for the post and opened a Google group instead. Welcome to juicer-dev.

Full article Juicer Google group.

Ruby version manager, Ubuntu and openssl

RVM (Ruby Version Manager) is a hot tool which makes switching between Rubys (1.8.6, 1.8.7, 1.9.1, JRuby, you name it) as simple as `rvm use 1.9.1`. However, on Ubuntu, you may hit trouble when using the openssl package for any non-system provided Ruby version.

Full article Ruby version manager, Ubuntu and openssl.

Emacs org-mode todo colors

A quick tip on how to customize the look of todo items in Emacs org-mode.

Full article Emacs org-mode todo colors.

Twibot gets a bunch of new features

A couple of weeks ago I received a pull request from Mike Demers for Twibot. However, in contrast to the occasional bug fix I receive, this branch included several new features.

Full article Twibot gets a bunch of new features.

Upcoming updates to Juicer

It's been quiet around here for a while. It's been quiet around Juicer, too. Both of those are going to change. After being given a push, Juicer is now finally up for some updates.

Full article Upcoming updates to Juicer.

Collecting tweets with Twibot and ActiveRecord

I recently launched a website that among other things displays "tweets" (status messages on Twitter) from a predefined set of Twitter users. In this article I'll show you how you can create a stateful Twibot bot with a custom handler to put tweets in your database using ActiveRecord from a Rails application.

Full article Collecting tweets with Twibot and ActiveRecord.

Syntactical sugar for your JavaScript unit tests

After switching my Ruby tests from vanilla Test::Unit to Shoulda (via Jeremy McAnally's Context) a while back I've gotten quite used to sexy unit tests. Coming back to JsUnitTest for JavaScript last night, I realized the syntac wasn't working for me anymore. So today, I fixed it.

Full article Syntactical sugar for your JavaScript unit tests.

Pimp my development environment!

Over the past few days I've been adding some bits and pieces that has really pimped by development environment into a slightly more productive one, and certainly a more enjoyable one.

Full article Pimp my development environment!.

Juicer - a CSS and JavaScript packaging tool

For best performance, CSS and JavaScript should be served up using as few requests and bytes as possible. Juicer is a new command line tool that helps by resolving dependencies, merging and minifying files. It can even check your syntax, add cache busters to and cycle asset hosts on URLs in CSS files and more.

Full article Juicer - a CSS and JavaScript packaging tool.

Chain of responsibility in Ruby

A simple but useful implemenation of the chain of responsibility pattern in Ruby.

Full article Chain of responsibility in Ruby.

Norway tells IE6 users to shape up

Yesterday, one of Norway's biggest commercial sites, finn.no started issuing a warning to all IE6 users telling them to upgrade their browsers. Today, a host of big norwegian sites are doing the same. The campaign to end IE6 usage is on!

Full article Norway tells IE6 users to shape up.

Using a far future expires header

By using a far future expires header you can efficiently control how assets are cached on the client, which results in improved performance. Here's how to set it up correctly with Apache, and some pointers on how to refresh users cache when you modify files.

Full article Using a far future expires header.

Liquid email templates in Rails

Liquid is a "safe, customer facing template language for flexible web apps". It's limited capabilities makes it the perfect email templating tool when you'd like designers and content producers to be able to edit and create email templates.

Full article Liquid email templates in Rails.

TDD/JavaScript: $()

Most modern JavaScript libraries offer some kind of "dollar sign function". As another applied example of test driven development in JavaScript I'll walk you through developing your own dollar sign function.

Full article TDD/JavaScript: $().

A test driven example

With my two introductory posts on JavaScript testing under the belt, it's time to do some actual testing. In todays post I walk you through a pretty simple example in test driven development with JavaScript, coding a trim() function. The end result is presented with Qunit, jsunittest.js and YUI Test.

Full article A test driven example.

Test driven development with JavaScript, part two

It's been a while since part one, but I guess late is better than never. In this second part I'll walk you through some available testing frameworks for JavaScript.

Full article Test driven development with JavaScript, part two.

Test driven development with JavaScript

In a series of three articles I am going to walk you through the what's and why's of unit testing and test driven development focusing on JavaScript. We'll look into the underlying concepts, available frameworks for JavaScript, and of course a practical example to top it all off.

Full article Test driven development with JavaScript.

What's all this then?

cjohansen.no goes inglés! I hereby announce my presence in the english speaking "blogosphere", and hope I'll be able to welcome both returning and new readers all the same.

Full article What's all this then?.

2006 - 2010 Christian Johansen Creative Commons License