How to Disable VCR for an RSpec spec

Dec 13, 2019

Sometimes you need to disable your testing tools in order to know what you’re testing. Mocking and stubbing are great. But only when you know what you are dealing with.

If you have VCR installed and configured in your Ruby app, and need to disable to make real requests until you know your code works, add the following lines.


Of course, make sure you take these lines out once you’re done.

Bypassing Self Signed SSL Certs with Curl

Dec 3, 2019

Working with some systems that have some self signed SSL certs for working in staging/sandbox environments and needed to test out some URLs. Naturally grabbed curl, but was getting an error.

curl: (51) SSL: no alternative certificate subject name matches target host name

Turns out the fix is easy. Just pass in the --insecure flag.

curl --insecure

Ory Hydra and localhost

Nov 13, 2019

I’ve always seen localhost and as the same thing. It’s definitely the same location. But I hadn’t considered that it may be seen as a different host. In fact, I’m still not sure if it is, or even if it should be.

I’ve spent a couple of days debugging some weird issues with Ory Hydra. Let’s set aside the fact that it uses OAuth2, but what seems to be in an unconventional way. I need to make about six http requests to get a token. I don’t know if that’s normal for an identity provider, but it seems excessive.

The issue I ran into was within those six calls, localhost and had gotten used interchangeably. I received various error messages. Everything from telling me the error is indistinguishable to errors about an unknown client, or errors about CSRF tokens.

While googling the error messages over and over, just looking for a sliver of hope, I saw a comment that fixed everything.

Turns out Hydra sees localhost and as different hosts, but doesn’t complain about an unknown host. That might have led me down the right path sooner. And I never use, so I’m pretty sure that was a config setting when I was using the 5 minute tutorial to set everything up.

Make sure to check what host you are passing around when setting up Hydra.

My Test Failed

Nov 13, 2019

I had an idea. I asked myself if I could create some sort of mini-course and sell it. Something super simple. Something like working with CSV files. The answer is no. But not only did it fail, it failed big time. Not one sale. Nothing.

So what went wrong? I have a few ideas.

  1. I was trying to sell a solution to something that was free all over the Internet. Seriously. Google “CSV Rails”. There is A LOT.
  2. It wasn’t really a solution. Watch me write code to import data from a CSV file is not a solution. It could be entertainment, I suppose.
  3. I assumed that because I was successful teaching in person, that I could do the same on the Internet and people would just know that I’m good at it. This is false.

Those reasons should be enough to scare anyone away, but I tried anyway. Now I just need to make sure I don’t make the same mistake twice.

For my next experiment, I’m going to try more audience/product validation. That seems like a better start.

Let the developer decide

Nov 12, 2019

Intentionally omitting documentation because you think someone should use a library might seem like a good idea. I mean we should use tools that are available to us. But when a developer needs to do something a little less conventional, it makes it really difficult to use your library.

I’m currently working on something with the oauth2 specification. And because reasons, we are implementing our own identity provider. We are still working within the parameters of the spec, we are just doing some authorization a little differently.

The library that we are using for our authorization server refuses to show all of the parameters needed to build urls for oauth2. The reason being you should not code this yourself and use a library instead. I agree. But sometimes, you need to build some things yourself. The fact that this library tells developers that they are not responsible enough to implement parts of the oauth2 spec themselves is short sighted to put in nicely.

A better approach might have been something like we strongly discourage you from implementing parts of the oauth2 spec yourself. There are plenty of really good libraries that can do this for you. Please consider one of those. But if you have to, here is the documentation you need

Let the developer decide.

CSV with Rails Mini Course

Aug 21, 2019

After years of talking about getting back into teaching, I’ve finally released something. I’m calling it a mini course. It’s a course on how to handle importing CSV data into a Rails application.

The timing of releasing it is nothing more than just being sick of not having something out there. I decided to make something small, iterate on it, and build something from there.

It contains four videos and covers:

  • How to upload a CSV file in a form
  • How to parse the content of the file
  • How to map the cells to attributes of a Rails model

It also contains all the source code used in the example as a full Rails app. It’s not Rails 6 though, I was almost done by the time Rails 6 was released. That could be an update.

It’s selling for $5 as an introductory price. I plan on adding a lot of stuff to it. As I do, the price will go up, but you will get all the updates for free regardless of what price point you came in at.

If you have purchased it, thank you! If you are on the fence, feel free to email me with any questions you have.

Here is short preview

You can buy the whole thing here -> Parsing CSV Files with Rails

How to Overwrite a Global gitignore

Aug 14, 2019

I’m a big fan of ignoring files globally with git. And all was good until I needed to overwrite a setting in the that global .gitignore. Git has that covered to. Add a ! in the local .gitignore to re add those files on a per project bases.

This will add the tags directory to the tracked files just for this project.


Using Contexts with RSpec

Jul 27, 2019

I was once given a programming exercise to complete for a job I was applying for. The exercise seemed pretty simple. Given a set of specs, make the code work. The specs were in rspec, which happens to be my testing tool of choice. I thought it should be pretty straight forward.

Turns out the specs made heavy use of contexts. So many, in fact, that I could barely figure out what the tests were testing. I was constantly jumping around the file, trying to figure out what context I was in.

I didn’t get the job.

Continue Reading Using Contexts with RSpec →

Git Tips to Help You Work Faster

Jul 23, 2019

The software development world is almost completely git-based now. I’m sure there are other version control systems being used, but I personally haven’t seen anything but git for several years. Git even extends beyond code. Authors use git for books, Universities use git for documentation, and some designers use git for large image files.

And while git is awesome and makes our jobs easier, it’s complex. Most people new to git learn a couple of commands that help them get through their day, not realizing that they could do more with a little bit more knowledge of git and the command line. I want to outline three additional things that I use that help make git even more powerful.

Continue Reading Git Tips to Help You Work Faster →

Software Developers and Cognitive Load

Jul 4, 2019

There are a lot of things that make a difficult job even more difficult. It’s often difficult to explain to non-developers how mentally exhausting creating software is. It’s just something that has to be experienced first hand.

Knowing that, it often seems that we don’t do enough to lessen the burden of cognitive load. Every developer has experienced the frustration of trying to fit more things in their brain than it can hold.

It’s one of the reasons why I am a fan of having a pen and a notebook handy to write down random things as they pop up. An easy way to make sure the cognitive ability you have is reserved for the most important work.

Continue Reading Software Developers and Cognitive Load →