Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ampers - Sara S - Media Ranker Revisited #30

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
!/log/.keep
!/tmp/.keep

.env


# Ignore Byebug command history file.
.byebug_history
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
source 'https://rubygems.org'

ruby '2.4.0'

git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
Expand Down Expand Up @@ -65,6 +64,7 @@ group :development do
# 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 'dotenv-rails'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
Expand Down
22 changes: 12 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ GEM
tzinfo (~> 1.1)
ansi (1.5.0)
arel (7.1.4)
autoprefixer-rails (8.2.0)
autoprefixer-rails (8.3.0)
execjs
babel-source (5.8.35)
babel-transpiler (0.7.0)
Expand All @@ -62,7 +62,11 @@ GEM
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
crass (1.0.3)
crass (1.0.4)
dotenv (2.2.2)
dotenv-rails (2.2.2)
dotenv (= 2.2.2)
railties (>= 3.2, < 6.0)
erubi (1.7.1)
erubis (2.7.0)
execjs (2.7.0)
Expand Down Expand Up @@ -117,7 +121,7 @@ GEM
method_source (~> 0.9.0)
pry-rails (0.3.6)
pry (>= 0.10.4)
puma (3.11.3)
puma (3.11.4)
rack (2.0.4)
rack-test (0.6.3)
rack (>= 1.0)
Expand Down Expand Up @@ -175,14 +179,14 @@ GEM
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
turbolinks (5.1.0)
turbolinks (5.1.1)
turbolinks-source (~> 5.1)
turbolinks-source (5.1.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.8)
uglifier (4.1.9)
execjs (>= 0.3.0, < 3)
web-console (3.5.1)
web-console (3.6.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
Expand All @@ -199,6 +203,7 @@ DEPENDENCIES
better_errors
byebug
coffee-rails (~> 4.2)
dotenv-rails
foundation-rails
jbuilder (~> 2.5)
jquery-rails
Expand All @@ -219,8 +224,5 @@ DEPENDENCIES
uglifier (>= 1.3.0)
web-console (>= 3.3.0)

RUBY VERSION
ruby 2.4.0p0

BUNDLED WITH
1.15.4
1.16.1
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Take some time to understand what each controller is doing. Add tests to the exi
- Tests custom controller logic and custom routes when appropriate
- Tests positive, negative, nominal and edge cases

<!-- ## Wave 2: Authentication via OAuth
## Wave 2: Authentication via OAuth

Following the steps in the Textbook curriculum, add OAuth to your Media Ranker Application and enable a user to log in.

Expand All @@ -56,7 +56,7 @@ Following the steps in the Textbook curriculum, add OAuth to your Media Ranker A
- `User` model -->


<!-- ## Wave 3: Basic Authorization (Page Access)
## Wave 3: Basic Authorization (Page Access)

In this wave we will create authorization logic to enforce rules that govern what pages on the site users and guests (unauthenticated browsers) can view. The rule we'll use is that guests can only access the main page, and all logged-in users can access the show and index pages for all categories of work.

Expand Down
Binary file added app/.DS_Store
Binary file not shown.
Binary file added config/.DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions config/initializers/omniauth.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Rails.application.config.middleware.use OmniAuth::Builder do
provider :github, ENV["GITHUB_CLIENT_ID"], ENV["GITHUB_CLIENT_SECRET"], scope: "user:email"
end
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
post '/works/:id/upvote', to: 'works#upvote', as: 'upvote'

resources :users, only: [:index, :show]
get "/auth/:provider/callback", to: "sessions#create"
get '/auth/github', as: 'github_login'
end
Binary file added db/.DS_Store
Binary file not shown.
27 changes: 27 additions & 0 deletions db/media_seeds.csv
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,30 @@ album,Blue Treat,Eliseo Gorczany,1979,Sit est quis veniam saepe.
book,Hello Town,Laury Walter,2005,Est sed ut asperiores sed fugiat.
album,Blacktop Choice,Casey Feil,2008,Temporibus ex maxime labore quam et natus quia ipsum.
book,Huggy Star,Nigel Lesch DVM,1962,Voluptatem ea aspernatur nesciunt ipsa quis error corporis placeat.
movie,Best in Show,Christopher Guest,1998,Dogshow mockumentary
movie,Pi,Darren A,1998,When you just cannot let go of a puzzle
movie,Die Brücke,Bernhard Wicki,1959,First major antiwar film to come out of Germany after World War II
movie,Toyko Story,Yasujirô Ozu,1953,An old couple visit their children and grandchildren in the city but the children have little time for them
movie,Hunt For The Wilderpeople,Taika Waititi,2016,A defiant young city kid who finds himself on the run with his cantankerous foster uncle in the wild New Zealand bush
movie,Antonia's Line,Marleen Gorris,1995,A Dutch matron establishes a matriarchal community where feminism and liberalism thrive
movie,Keanu,Jordan Peele,2016,Two friends track down a stolen kitten
movie,The Red Violen,François Girard,1998,A perfect red-colored violin inspires passion
movie,Volver,Pedro Almodóvar,2006,A mother returns to her home town in order to fix the situations she couldn't resolve during her life
movie,Her,Spike Jonze,2013,A lonely writer develops an unlikely relationship with an operating system designed to meet his every need
movie,Noi,Dagur Kári,2003,17 year old Noi drifts through life on a remote fjord in the north of Iceland
movie,Rokk í Reykjavík,Friðrik Þór Friðriksson,1982,Overview of the powerful and expanding rock scene in Iceland
movie,Rams,Grímur Hákonarson,2015,two brothers who haven't spoken in 40 years have to come together in order to save what's dearest to them - their sheep
movie,101 Reykjavík,Baltasar Kormákur,2000,Set in downtown Reykjavik
movie,Englar alheimsins,Friðrik Þór Friðriksson,2000,Story of an Icelandic man who slowly descends into madness and depression after his girlfriend leaves him
movie,The Juniper Tree,Nietzchka Keene,1990,Story of two sisters who escape their home after their mother is stoned and burned for witchcraft
book,As I Lay Dying,Faulkner,1950,The mom dies
book,Thinking Fast and Slow,Daniel Kahneman,2011,2011 by Nobel Memorial Prize in Economic Sciences
book,Cracking the Coding Interview,Gayle Laakmann McDowell,2016,189 Programming Questions and Solutions
book,An Introduction to Functional Programming,Michaelson,1989,About the world's smallest programming language
book,The C Programming Language,Kernighan,1988,BC wears well as one's experience with it grows
book,Data Analysis with Open Source Tools,Janett,2011,Concise reference for understanding how to conquer piles of data
book,Visualize This,Nathan Yau,2011,See your data in new ways
book,Critical Race Theory,Richaard Delgado and Jean Stephancic,2012,Compact introduction
book,Justice,Mischael Sandel,2009,Relates the big questions of political philosophy to the most vexing issues of our time
book,Independent People,Halldor Laxness,1946,Winner of the 1955 Nobel Prize in Literature
book,Johnny Got His Gun,Dalton Trumbo,1939,Surely one of the most brutally and unflinchingly honest books about the horrors of war
Binary file added lib/.DS_Store
Binary file not shown.
Binary file added test/.DS_Store
Binary file not shown.
14 changes: 14 additions & 0 deletions test/controllers/sessions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,18 @@

describe SessionsController do

describe "login" do
it 'succeeds at finding login path' do
get login_path
must_respond_with :success
end
end

describe "logout" do
it 'succeeds at if no user' do
get logout_path

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no get route for logout. It's a delete route

must_respond_with :success
end
end

end
27 changes: 27 additions & 0 deletions test/controllers/users_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
require 'test_helper'

describe UsersController do
describe 'index' do
it "should get index" do
User.count.must_be :>, 0
get users_path
must_respond_with :success
end

it "should get delete" do
Vote.destroy_all
User.destroy_all
get users_path
must_respond_with :success
end

end

describe 'show' do
it "should respond to show" do
get user_path(User.first)
must_respond_with :success
end

it "should not show non-existant user " do
get user_path(100)
must_respond_with :not_found
end

end
end
Loading