GithubHelp home page GithubHelp logo

susannasouv / cs169-urdb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from saasbook/cs169-urdb

0.0 2.0 0.0 29 KB

UR database for CS 169 discussion.

Ruby 82.94% JavaScript 1.82% CSS 1.87% HTML 13.37%

cs169-urdb's Introduction

Hello, fellow developers!

Welcome to URDb, your go-to source for all things movies related. Whether it be movie ratings, actors, or reviews, you know you can find it all here! (Kind of.)

As successful as we have been so far, we've run into alot of bugs - and because of that, we've hired you to come and write an extensive (ish) test suite to prevent problems in the future. Let's get you set up.

Setup

To begin, clone/fork this repository.

Afterwards, run:

bundle install

to install rspec, our testing framework of choice.

To create our database, run:

rake db:create && rake db:migrate

Let's make sure our testing framework is working by running

rspec

You should see tests run....and fail. What happened?

What do the failed tests tell you? What expectation is not being met? What aspects of the app could be failing? Discuss your ideas with your partner!

When you're done, let's keep going.

Part 1

Let's first take a look at what we have so far - it looks like we have a movies model, that has a name, and a rating - see /app/models/movie.rb.

The tests you ran earlier were in spec/models. We need to make sure the data is validated before we save our models - unfortunately URDb didn't have time to make the tests pass before giving the code to you.

Your job: Add the proper validations to the movie model to make the tests pass.

Hint: Take a look at the rails documentation to see how validations on data are implemented.

Part 2

Now that you've been able to take a peek into our testing framework, it's time practice TDD and write your own tests. URDb wants to add a new feature that averages the ratings from a list of movies that we 'fetch' from Paramount Pictures. We've added a method where you can implement that in the movies model. (average_paramount_rating).

First, let's write some tests for the expected behavior for our method. If you take a look at the self.from_paramount method in the movies class, you'll see that we've simulated a ten second sleep, which would usually come from calling the Paramount Pictures API.

Your job:

  1. Stub that method so that we don't have to wait ten seconds every time we call this method.

  2. Add more test cases to test corner cases (as well as normal use cases) - what if the list is empty?

If you need help, consult the rspec documentation first before asking a GSI!

Note: Remember that you should be writing your tests before writing that actual implementations of these methods.

cs169-urdb's People

Contributors

darryqueen avatar charlesx2013 avatar

Watchers

James Cloos avatar Susanna Souv 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.