Today I Learned

A Hashrocket project

5 posts by philcapel

Seeing tmux messages easier

Using tmux is pretty slick, until something doesn’t work and you want to see the error message for longer that about 750ms. That’s the default setting for the messages to be displayed.

Set a new display time

For the current session

:set-option display-time <milliseconds>

So set-option display-time 4000 would set your display time to 4 seconds.

Globally

Add the -g flag.
Or add it to your tmux.conf to hold on to the configuration:

set-option -g display-time <milliseconds>

View all messages

If you want to view all the recent messages, then you can use

:show-messages

Default hot-key

<tmux-leader>~

To close out of the messages, just press <enter>.

Rails CollectionProxy #length vs #count

When testing a controller, it’s not unreasonable to right a test something like this:

expect(post_to_endpoint).to change { some.objects.length }.from(0).to(1)

Because of the details of CollectionProxy, this will not work as expected. Instead, you need to write:

expect(post_to_endpoint).to change { some.objects.count }.from(0).to(1)

The length method will evaluate to the same value, while the count method will reflect changes to the underlying data since the last call.