Giter Site home page Giter Site logo

rspec_kata's Introduction

#Welcome to the Seat Reservation System 2000

This is a revolutionary command line tool to reserve seats in a train. The service is already provided and you need to refactor the tests.

To run it you need Ruby >= 1.8 and rspec installed.

When you have Ruby installed, to install RSpec run:

 gem install rspec

or, depending on your system,

 sudo gem install rspec

To run the tests run

rspec

if everything is installed correctly, you get

....

Finished in 0.01621 seconds
4 examples, 0 failures
Run options: 

# Running tests:

......

Finished tests in 0.010854s, 552.8162 tests/s, 644.9522 assertions/s.

6 tests, 7 assertions, 0 failures, 0 errors, 0 skips

###How the application works

This app implements the following two user stories:

As a passenger, I want to reserve seats on the train so that I can sit with my homies. And of course I want to know the number(s) of the seat(s) I reserved, duh.

As a Deutsche Bahn personnel, I want to get a list of the seats that are reserved so that I can mark them in the carraige with a little 'X' so that those freeloaders who don't pay to reserve seats don't stop me from making my millions.

It's a ruby app, so we've provided you with a ruby script that handles the commandline input and output, if you want to try it out. This is an example how it works:

> ./reserve.rb

You will get a prompt:

Welcome to the SRS 2000!
How many seats do you want to reserve?
2  <-- your customer enters this
Your reserved seat numbers are:
12,13 <-- your program calculates this

If you run the other script list, it will list the 20 first seats that are reserved, eg.

> ./list.rb
The following seats are reserved:
1,2,3,4,5,6,7,8,9,10,11,12,13

That means seats 1-13 have been reserved. For now the carriage has 20 seats in rows of 2. You can allocate the seats just sequentially for now, nothing fancy.

However in this kata, you should focus more on the tests.

###The challenge

First improve reservation_service_spec.rb using RSpec. Start with list_reservations and then refactor the tests for reservations.

Then refactor store_spec.rb. There is sample code for the necessary mocking in the comments.

Solution

You can find a link to the solution in the issues (so that you do not peek too early ;-))

rspec_kata's People

Contributors

holsky avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.