Skip to content

jordanpoulton/ruby-coding-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ruby-coding-challenge

We're going to practice solving some Ruby problems and be introduced to the rspec part of Ruby testing.

These questions vary in level from quite easy to fairly hard.

Work through them and check if they're correct by running rspec after trying some code.

You should be able to answer most questions with a couple of lines of code, and just a few methods.

If you're writing a long, complex solution, there's probably a better way.

Getting started

Our recommended guide to starting this project:

============

  • Fork this repo to your own Github
  • Clone it down to your local machine
  • Run bundle install (you may need an extra something to get this working ... )
  • Answer the first question (in the challenge section)
  • Make a commit the answer and push it up to your repo
  • Send a pull request straight away (yes - after your first answer)
  • Answer the second question (in the challenge section)
  • Commit the answer and push it up to your repo
  • and repeat to get into the habit of learning both Ruby and Version Control

... the PR will automatically update itself!

To run the specs, just run

$ rspec questions_spec.rb

Good luck

Rules

  • Try and get the RSpec tests to pass (but not by cheating - i.e. hardcoding the expected value)
  • You shouldn't need any extra libraries or gems
  • The cleaner your code the better!
  • Googling is fine as usual

Tips

  • Use the ruby docs http://www.ruby-doc.org/
  • Try and break down the problems into smaller chunks. For e.g. if you google "How to select elements in an array that start with a", you won't have much luck. Try and find out a) how to select certain elements in an array, b) how to test if a string starts with an 'a'
  • Don't forget Enumerable (advanced array methods)
  • Don't panic 😉

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages