Currently concentrating on Ruby!
Image for post
Image for post

This is aimed at anyone recently taking up RSpec testing for Ruby.

I am always looking for ways to refactor my code, a standard rule for programmers. But you can stare at code for so long and sometimes not see what you can change without potentially being exposed to a certain gem in someone else’s project or a commercial setting. Having self-taught myself RSpec I had no real guidance in what to learn, luckily there was one good Udemy course that is fairly basic but covers good practice, the core RSpec methods and the basic fundamentals of RSpec called: Testing Ruby With RSpec. I then bought the Effective Testing With RSpec 3 book. This book is a good reference point but I found the walkthrough Sinatra App at the beginning a little dense for someone new to code. …

Image for post
Image for post

So in my last blog, I built the basics of creating a database, dropping a database, creating an instance of your class, and saving that instance to the database. Now I want to move on to some more methods. I ended the last blog talking about how the data we get back from a database query is an array so now I want to show you how to build methods such as:

  • Building an instance from the data you receive from the database.
  • Update an instance method
  • Tweak the save method to include the ability to update an instance.
  • Find an instance in a database or create a new one if it doesn’t exist. …

Image for post
Image for post

I decided that although I loved Rails and Ruby, you could build a perfectly simple API or Rails application without understanding too much of what is going on in the background. For instance, after doing my Bootcamp, I knew that the Create action from CRUD essentially bundled the new and create actions together. I knew that a method like User.create (if valid) would create a new instance of a user. Could I tell you the SQL that was used, probably not, I just knew that it was running the query for me in the background and could check it out in the development log if I wanted to. …

Image for post
Image for post

During a final stage interview recently, I was asked towards the end of my technical test if I knew FizzBuzz and if I could please implement some code to write a successful FizzBuzz script! The review of my take-home showed that I could write tests, but didn’t show my thinking, logic, and understanding of how to write tests. Now, I didn’t have long left in my test so they were more looking to see how I would tackle this particular exercise.

The concept of FizzBuzz is:

  1. You are given a number (n). This number will be your last number in your range. Starting at 1. …

Image for post
Image for post

Recently I have been looking more and more into plain old Ruby, no Rails framework, just trying to better understand the language behind it. Having built projects using pure Ruby and Rails, I have come to find I have some questions about what goes where. Which is good. Curiosity makes you want to dig deeper, which means you are intrigued by what you are finding / not finding and want to better understand what you are building.

Recently playing around with some Ruby, I found I was repeating certain methods. Let’s take a trivial example. …

Image for post
Image for post

I have taken a bit of a step back on blogs for front-end and React-based projects/skills to also focus on Ruby. After doing a take-home exam a week ago, I realised I was adept enough at making my own RoR project but creating a Regex, plain Ruby setup from nothing… I was not. It felt weird knowing the workings of Rails and yet in a plain Regex file, forgetting to use require ‘path_name’. I think that’s one thing that is good and bad about Ruby. So much of the work is done automatically for you in the background thanks to the stability and longevity of the Ruby community and language, but at the same time, knowing x does y, doesn’t necessarily help you understand why x does y. During the take home exam, I found myself learning new and simple things, both for testing with rspec and better use of Ruby enumerables. …

Image for post
Image for post

I almost felt guilty not doing camel casing for the title!

Having based my last blog around the basics of setting up a redux project, I wanted to build a simple app with this blog to showcase a full example of Redux, including the use of Redux Thunk. Building simple projects is a great way to learn, writing about them is a great way to test your memory and knowledge and feedback is a great way to see errors / learn some more!

I decided to build this Counter app because writing my blog last week made me realize my memory of building out a project with all the boilerplate Redux was a little bit too hazy for my liking. …

Image for post
Image for post

This is a slight diversion on what my next blog was meant to be about. Context API and testing it with Jest + Enzyme. Why? Because I have done some more reading around Redux and wanted to aim something potentially at Bootcamp students who were getting into their final projects, or having some trouble managing their state and props in a project.

This is something that I definitely struggled with in my final project and since wish, I had the confidence to have implemented Redux. My project involved a lot of components with plenty of different level components. This meant that passing data from one component to another became difficult to track and made my components look… clunky. No one wants clunky. …

Image for post
Image for post

My last blog was all about context API and how to set it up plus some benefits to it, as well as a couple of good links to comparisons between Context and Redux.

Now in this blog, I want to talk about setting up Enzyme, the use of it and a couple of tests. THEN I will do a blog on testing Context API in React.

Now Jest is a Javascript testing framework that was created by the developers of React. But, Jest is not actually limited to React, however, Enzyme is specifically designed to test React components.

To setup Jest please refer to one of my previous blogs — found here. …

Image for post
Image for post

In my final project of my Flatiron Bootcamp, I felt encumbered by the number of components and containers. Mapping out the highest component to store state so that it could reach all the necessary components was painful, tracking the props down to the necessary components was equally difficult as the project became more layered.

So, I wanted to learn Redux to be able to have better state management, it was difficult to keep track of the props you were drilling down, so having something like Redux was perfect. I set off to learn more about Redux from my Flatiron Bootcamp and bought a Udemy course as well to teach me the best and latest use of hooks. Here, I stumbled across one interesting brief part of the course. No more than 15 minutes in total out of a course that spanned 41 hours. I was introduced to a new way to manage prop drilling without having to pass props down through every component. …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store