-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 939abd0
Showing
80 changed files
with
1,550 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# See https://help.github.com/articles/ignoring-files for more about ignoring files. | ||
# | ||
# If you find yourself ignoring temporary files generated by your text editor | ||
# or operating system, you probably want to add a global ignore instead: | ||
# git config --global core.excludesfile '~/.gitignore_global' | ||
|
||
# Ignore bundler config. | ||
/.bundle | ||
|
||
# Ignore the default SQLite database. | ||
/db/*.sqlite3 | ||
/db/*.sqlite3-journal | ||
|
||
# Ignore all logfiles and tempfiles. | ||
/log/* | ||
/tmp/* | ||
!/log/.keep | ||
!/tmp/.keep | ||
|
||
# Ignore uploaded files in development | ||
/storage/* | ||
!/storage/.keep | ||
|
||
/node_modules | ||
/yarn-error.log | ||
|
||
/public/assets | ||
.byebug_history | ||
|
||
# Ignore master key for decrypting credentials and more. | ||
/config/master.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ruby-2.5.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
source 'https://rubygems.org' | ||
|
||
|
||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | ||
gem 'rails', '~> 5.0.0', '>= 5.0.0.1' | ||
# Use sqlite3 as the database for Active Record | ||
gem 'sqlite3' | ||
# Use Puma as the app server | ||
gem 'puma', '~> 3.0' | ||
# Use SCSS for stylesheets | ||
gem 'sass-rails', '~> 5.0' | ||
# Use Uglifier as compressor for JavaScript assets | ||
gem 'uglifier', '>= 1.3.0' | ||
# Use CoffeeScript for .coffee assets and views | ||
gem 'coffee-rails', '~> 4.2' | ||
# See https://github.com/rails/execjs#readme for more supported runtimes | ||
# gem 'therubyracer', platforms: :ruby | ||
#use Haml for templates | ||
gem 'haml' | ||
|
||
# Use jquery as the JavaScript library | ||
gem 'jquery-rails' | ||
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks | ||
gem 'turbolinks', '~> 5' | ||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder | ||
gem 'jbuilder', '~> 2.5' | ||
# Use Redis adapter to run Action Cable in production | ||
# gem 'redis', '~> 3.0' | ||
# Use ActiveModel has_secure_password | ||
# gem 'bcrypt', '~> 3.1.7' | ||
|
||
# Use Capistrano for deployment | ||
# gem 'capistrano-rails', group: :development | ||
|
||
group :development, :test do | ||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console | ||
gem 'byebug', platform: :mri | ||
end | ||
|
||
group :development do | ||
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code. | ||
gem 'web-console' | ||
gem 'listen', '~> 3.0.5' | ||
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring | ||
gem 'spring' | ||
gem 'spring-watcher-listen', '~> 2.0.0' | ||
gem 'rspec-rails' | ||
end | ||
|
||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem | ||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] | ||
|
||
group :test do | ||
gem 'cucumber-rails', :require => false | ||
gem 'cucumber-rails-training-wheels' | ||
gem 'database_cleaner' | ||
gem 'capybara' | ||
gem 'launchy' | ||
gem 'rspec-rails' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
BDD, TDD Cycle | ||
=== | ||
|
||
In this assignment you'll use BDD & TDD to add a "find movies with same director" feature to RottenPotatoes. Follow the steps below: | ||
|
||
1) in your computer, create a directory named ```HW4/ ``` | ||
|
||
2) in your newly created ```HW4/``` type: | ||
|
||
```shell | ||
rails new rottenpotatoes –T | ||
``` | ||
3) create a directory named ```Temp``` in your ```HW4/ ```. | ||
|
||
4) in the folder ```HW4/Temp``` folder, clone the content of this github repo: | ||
```shell | ||
git clone git://github.com/Genaina/HW4 | ||
``` | ||
5) copy all downloaded github content into HW4/rottenpotatoes and overwrite the following local directories or files: | ||
```shell | ||
app/ | ||
db/ | ||
features/ | ||
config/routes.rb | ||
Gemfile | ||
``` | ||
6) remove folder ```/Temp``` | ||
|
||
7) create your HW4 git repository and push the content of your local HW4/rottenpotatoes | ||
|
||
Please now follow the instructions below to get setup: | ||
---- | ||
|
||
1) Change into the rottenpotatoes directory: cd HW4/rottenpotatoes | ||
2) Run bundle install --without production to make sure all gems are properly installed. | ||
3) Run bundle exec rake db:migrate to apply database migrations. | ||
4) Finally, run these commands to set up the Cucumber directories (under features/) and RSpec directories (under spec/) if they don't already exist, allowing overwrite of any existing files: | ||
|
||
```shell | ||
rails generate cucumber:install capybara | ||
rails generate cucumber_rails_training_wheels:install | ||
rails generate rspec:install | ||
``` | ||
5) You can double-check if everything was installed by running the tasks `rake spec` and `rake cucumber`. | ||
|
||
Since presumably you have no features or specs yet, both tasks should execute correctly reporting that there are zero tests to run. Depending on your version of rspec, it may also display a message stating that it was not able to find any _spec.rb files. | ||
|
||
**Part 1: add a Director field to Movies** | ||
|
||
Create and apply a migration that adds the Director field to the movies table. | ||
The director field should be a string containing the name of the movie’s director. | ||
HINT: use the `add_column` method of `ActiveRecord::Migration` to do this. | ||
|
||
Remember that once the migration is applied, you also have to do `rake db:test:prepare` | ||
to load the new post-migration schema into the test database! | ||
|
||
**Part 2: use BDD+TDD to get new scenarios passing** | ||
|
||
We've provided [three Cucumber scenarios](http://pastebin.com/L6FYWyV7) to | ||
drive creation of the happy path of Search for Movies by Director. | ||
The first lets you add director info to an existing movie, | ||
and doesn't require creating any new views or controller actions | ||
(but does require modifying existing views, and will require creating a new step definition and possibly adding a line | ||
or two to `features/support/paths.rb`). | ||
|
||
The second lets you click a new link on a movie details page "Find Movies With Same Director", | ||
and shows all movies that share the same director as the displayed movie. | ||
For this you'll have to modify the existing Show Movie view, and you'll have to add a route, | ||
view and controller method for Find With Same Director. | ||
|
||
The third handles the sad path, when the current movie has no director info but we try | ||
to do "Find with same director" anyway. | ||
|
||
Going one Cucumber step at a time, use RSpec to create the appropriate | ||
controller and model specs to drive the creation of the new controller | ||
and model methods. At the least, you will need to write tests to drive | ||
the creation of: | ||
|
||
+ a RESTful route for Find Similar Movies | ||
(HINT: use the 'match' syntax for routes as suggested in "Non-Resource-Based Routes" | ||
in Section 4.1 of ESaaS) | ||
|
||
+ a controller method to receive the click | ||
on "Find With Same Director", and grab the id (for example) of the movie | ||
that is the subject of the match (i.e. the one we're trying to find | ||
movies similar to) | ||
|
||
+ a model method in the Movie model to find movies | ||
whose director matches that of the current movie | ||
|
||
It's up to you to | ||
decide whether you want to handle the sad path of "no director" in the | ||
controller method or in the model method, but you must provide a test | ||
for whichever one you do. Remember to include the line | ||
`require 'spec_helper'` at the top of your *_spec.rb files. | ||
|
||
We want you to report your code coverage as well. | ||
|
||
Add the following lines to | ||
the TOP of spec/spec_helper.rb and features/support/env.rb: | ||
|
||
```ruby | ||
require 'simplecov' | ||
SimpleCov.start 'rails' | ||
``` | ||
|
||
Now when you run `rake spec` or `rake cucumber`, SimpleCov will generate a report in a directory named | ||
`coverage/`. Since both RSpec and Cucumber are so widely used, SimpleCov | ||
can intelligently merge the results, so running the tests for Rspec does | ||
not overwrite the coverage results from SimpleCov and vice versa. See | ||
the [ESaaS screencast](http://vimeo.com/34754907) for step-by-step instructions on setting up SimpleCov. | ||
|
||
**TURN-IN:** | ||
|
||
+ Cucumber feature file (if different from the one provided) | ||
+ Cucumber step definitions (i.e., contents of your features/ directory) | ||
+ RSpec tests (i.e., contents of spec/ directory) | ||
+ SimpleCov report files showing 90% or greater coverage for your models and controllers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require_relative 'config/application' | ||
|
||
Rails.application.load_tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
//= link_tree ../images | ||
//= link_directory ../javascripts .js | ||
//= link_directory ../stylesheets .css |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// This is a manifest file that'll be compiled into application.js, which will include all the files | ||
// listed below. | ||
// | ||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, | ||
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. | ||
// | ||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | ||
// compiled file. JavaScript code in this file should be added after the last require_* statement. | ||
// | ||
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details | ||
// about supported directives. | ||
// | ||
//= require jquery | ||
//= require jquery_ujs | ||
//= require turbolinks | ||
//= require_tree . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Action Cable provides the framework to deal with WebSockets in Rails. | ||
// You can generate new channels where WebSocket features live using the rails generate channel command. | ||
// | ||
//= require action_cable | ||
//= require_self | ||
//= require_tree ./channels | ||
|
||
(function() { | ||
this.App || (this.App = {}); | ||
|
||
App.cable = ActionCable.createConsumer(); | ||
|
||
}).call(this); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* This is a manifest file that'll be compiled into application.css, which will include all the files | ||
* listed below. | ||
* | ||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, | ||
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. | ||
* | ||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the | ||
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS | ||
* files in this directory. Styles in this file should be added after the last require_* statement. | ||
* It is generally better to create a new file per style scope. | ||
* | ||
*= require_tree . | ||
*= require_self | ||
*/ | ||
|
||
html, body { | ||
margin: 0; | ||
padding: 0; | ||
background: White; | ||
color: DarkSlateGrey; | ||
font-family: Tahoma, Verdana, sans-serif; | ||
font-size: 10pt; | ||
} | ||
div#main { | ||
margin: 0; | ||
padding: 0 20px 20px; | ||
} | ||
a { | ||
background: transparent; | ||
color: maroon; | ||
text-decoration: underline; | ||
font-weight: bold; | ||
} | ||
h1 { | ||
color: maroon; | ||
font-size: 150%; | ||
font-style: italic; | ||
display: block; | ||
width: 100%; | ||
border-bottom: 1px solid DarkSlateGrey; | ||
} | ||
h1.title { | ||
margin: 0 0 1em; | ||
padding: 10px; | ||
background-color: orange; | ||
color: white; | ||
border-bottom: 4px solid gold; | ||
font-size: 2em; | ||
font-style: normal; | ||
} | ||
table#movies { | ||
margin: 10px; | ||
border-collapse: collapse; | ||
width: 100%; | ||
border-bottom: 2px solid black; | ||
} | ||
table#movies th { | ||
border: 2px solid white; | ||
font-weight: bold; | ||
background-color: wheat; | ||
} | ||
table#movies th, table#movies td { | ||
padding: 4px; | ||
text-align: left; | ||
} | ||
#notice, #warning { | ||
background: rosybrown; | ||
margin: 1em 0; | ||
padding: 4px; | ||
} | ||
form label { | ||
display: block; | ||
line-height: 25px; | ||
font-weight: bold; | ||
color: maroon; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module ApplicationCable | ||
class Channel < ActionCable::Channel::Base | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module ApplicationCable | ||
class Connection < ActionCable::Connection::Base | ||
end | ||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class ApplicationController < ActionController::Base | ||
protect_from_forgery with: :exception | ||
end |
Empty file.
Oops, something went wrong.