Giter Site home page Giter Site logo

rails-exercise-16's Introduction

SWT2 2016/17 - Introductory Exercise

We prepared an application skeleton for you that has a failing test case.

To pass the exercise, follow these steps:

1) Fork this repository.

  • You need to be logged-in with your Github account.
  • Click the "Fork" button in the upper right.

fork

issues

2) Set-up Travis CI for your fork

  • Log-in to Travis CI and
  • Enable automatic builds for your exercise repository.

3) Setup development environment

  • Clone the repository to your local machine

Option 1: Setup locally

  • Change into the newly created directoy
  • Inside the directory, check the used Ruby version using ruby --version. It should be 2.2.2. Other Ruby versions might work, but this is the one that was tested.
  • If the correct Ruby version is not used, install a ruby version manager, for example rbenv using the instructions for rbenv installation and ruby-build installation.
    • WARNING: If you already have the Ruby version manager RVM installed, please use that or uninstall it prior to rbenv installation, as the two version managers are incompatible.
  • Install Ruby version 2.2.2 with rbenv install 2.2.2
  • The .ruby_version file in the repository instructs the ruby version manager to use the correct version.

Option 2: Use a VM

  • Install Virtualbox (the VM provider) and Vagrant (to manage VMs) for your platform.
  • Download the prepared VM image and install the dependencies:
vagrant up # download the image and start the VM
vagrant ssh # connect via ssh
cd hpi-swt2
bundle install # install dependencies
exit # restarting the session for changes to take effect
  • In order to start the development server:
vagrant ssh #connect with VM
cd hpi-swt2
rails s -b 0 #starting rails server, the -b part is necessary since the app is running in a VM and would otherwise drop the requests coming from the host OS
  • Edits to files in the local folder will be mirrored into the VM's hpi-swt2 folder as the folders are synced.

4) Dive into the code

  • Run bundle install to install the dependencies of the project (they are stored in the Gemfile)
  • Run rspec to run the tests (RSpec is a test framework for Ruby)
  • Try to get the failing test green.

5) Commit and push

  • When you are done, push your changes.
  • Travis CI will now try to build your project.

6) Check your inbox

  • You will be notified of problems via Github issues.
  • While you wait, see if your code can use some refactorings, continue reading the tutorial, or plan the next steps.

7) For each ticket

  • Write a test that documents the missing or failing behavior.
    • Unit tests are preferred.
  • Commit the failing test and reference the issue.
    • The commit message could be Failing test for #<ISSUE NUMBER>.
    • There is no need to push the failing commit.
  • Fix the issue and commit all changes.
    • The commit message could be <CHANGED THE THING>. Closes #<ISSUE NUMBER>.

8) Repeat steps 5 to 7 until the exercise is complete.

Tips:

  • This exercise is designed to be solved while reading the official Rails tutorial
  • run rspec spec/<path_to_spec>.rb to only run one set of specs
  • have a look at /spec/factories to get 'inspiration' for your data model
  • Besides simple scaffolds, associations and validations are needed ...
  • occasionally start up the server (rails s) and have a look at the app in your browser (http://localhost:3000)
  • Look at the Mockup: https://gomockingbird.com/mockingbird/index.html?project=v890g6l#v890g6l/OQMURm
  • Make sure that all local changes are committed (git status) and pushed to the upstream repository (i.e., the one on GitHub) before the deadline

rails-exercise-16's People

Contributors

tbjoern avatar derari avatar

Watchers

 avatar

rails-exercise-16's Issues

Author index page should list first and last name in one column

When a user visits the authors index page
Then it should have a column titled 'Name'

Expected to find css "th" with text "name" but there were no matches. also found "first name", "last name", "homepage", "", which matched the selector but not all filters.

New author page should render

When a user visits the new author page
Then the page should render

Got NameError: undefined local variable or method `new_author_path' for #RSpec::ExampleGroups::NewAuthorPage:0x0000000768cf20

Author index page should link to the new author page

When users visits the authors index page
Then it has a link 'Add author'

Expected to find css "a" with text "add author" but there were no matches. also found "add author", which matched the selector but not all filters.

Author #name should return the full name

Given an author a with first name 'Alan' and last name 'Turing'
Then a.name should be 'Alan Turing'

Got NoMethodError: undefined method `name' for #Author:0x00000006723868

Author index page should link to the new author page

When users visits the authors index page
Then it has a link 'Add author'

Expected to find css "a" with text "add author" but there were no matches. also found "new author", which matched the selector but not all filters.

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.