Foundations of Software Engineering

Homework 5: MVC Controller

For this homework, you will build upon the models from the previous homework to create an actual working web app—mainly by adding controllers and views. Moreover, you will continue to practice with the version-control system, Git.

You will do this homework as a team; however, each member of your team will be responsible for the completion of a particular task.

Each team member will choose one task from the list below to complete. All team members must do a different task. If your team has only three members, then ignore Task 4.

The Tasks

For this homework, there will be four tasks (Tasks 1 through 4), each of which will build upon the corresponding task from Homework 4. As a reminder, here are the model classes and their associated tasks from Homework 4:

Task 1:

alt text

Task 2:

alt text

Task 3:

alt text

Task 4:

alt text

In particular, each task must do the following.

Add More Model Validations and Unit Tests

In the previous homework task, you added validations to only one of the model classes. For this homework, you must add validations to the other model class. In particular, you must add one validation per attribute of the class, and each validation must be of a different type. For example, the first attribute might have a length validation, the second might have a format validation, the third might have an inclusion validation, and the fourth might have a numericality validation.

Additionally, you must also create unit tests for these new validations. In particular, you will treat these validations the same as you did for the last homework—that is, for each validation, you must write one test that violates the validation rule.

Create Standard Controller Actions/Pages

Create 5 different seed-data objects for each model class (i.e., in db/seeds.rb) for a total of 10. Be sure to use the create! method (with a !) to create them, so you will get error messages if a validation error occurs.

Create two controllers, each corresponding to a model class. Each controller must have the standard controller actions/pages detailed in class:

The pages must have the features demonstrated in class, including inter-page links and notice/alert/error message handling. Be careful to follow the standard Ruby/Rails naming conventions.

As additional constraints, you must:

Create “Lucky” Actions

In addition to the standard actions/pages, you must do the following for each of your controller classes:

IMPORTANT: Be sure to add your university username (e.g., mine is “sdflming”) in a code comment at the top of your controller class files. (Otherwise, how will we know which work is yours?)

Furthermore, you must add hyperlinks to your controllers’ index pages on the project home page. This will enable visitors (and graders) to conveniently navigate to each team member’s pages.

How to submit your team’s work

Before you can submit, all team members must have merged their code into the master branch and pushed the updates to GitHub. If a team member does not complete his/her work on time, you may submit without his/her contribution.

To submit your team’s work, you must “tag” the current commit in the master branch:

To grade your work, I will check out the appropriate tag, and run it on my machine.

Note that if for some reason you need to update your submission, simply repeat the tagging process, but increment the version number (e.g., hw5v2, hw5v3, hw5v4, etc.).

Rubric

Total marks: 100

Below, the top-level number is the items total point value. If an item is not submitted at all, 0 points will be awarded for that item. The sub-bullets indicate standard deductions for errors in a submitted item. The deduction list below may not be complete because there may be mistakes that we did not expect. The deduction for an unexpected mistake will be assessed at the time it’s discovered and will reflect how severe the instructor thinks the mistake is.

Other deductions:

© Scott D. Fleming 2018 • Made with GitHub Pages and Markdown