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

Ports - Myriam #18

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open

Ports - Myriam #18

wants to merge 28 commits into from

Conversation

MyriamWD
Copy link

@MyriamWD MyriamWD commented May 13, 2019

MediaRanker Revisited

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
What did you need to configure and setup to make OAuth installed and work? Make sure I had OmniAuth gem, .env file with secrets, and .env added to gitignore. Create initializer omniauth file. Add route for login and callback. Add create action to the users controller and implement auth_hash. Generate new migrations to add name, email, uid, provider columns to user table. Run migrations. Add build from GitHub method to the model, implement it in the create action in users controller. Add logout route. Add destroy action to users controller. Make sure to implement the paths on the view for the login and logout button.
What areas of Rails app code did you need to create/write/modify in order to change logging in to use OAuth? Routes, schema, user model, user controller (previous login implemented), and tests.
What was one controller test you updated? Why did you need to update it? edit in works controller. Login is required to execute that action after implementing authorization. I had to use the test helper perform login action to make it work.
Why did we need to mock OAuth for testing? To eliminate dependencies in testing and be able to tests even when there is not network connection.

@CheezItMan
Copy link

MediaRanker Revisted

What We're Looking For

Feature Feedback
General
Completed OAuth Check
Appropriate Tests on WorksController Missing Tests for guest users
Appropriate Tests on UsersController Check
Basic Authorization (who can see what) Check, plus bonus work, nice controller filters
Overall Not bad, you hit all the learning goals, except writing tests for guest users in the WorksController. That's a pretty big thing to miss. I suggest scheduling a bit of time each day to review your code and look for missing tests, a coverage report would have revealed that your checks for guest users weren't being tested.

@@ -35,12 +35,14 @@

describe "index" do
it "succeeds when there are works" do
perform_login

Choose a reason for hiding this comment

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

One problem with these tests is that you don't have a set of tests for guest users. So you don't have tests that assure that guest users can't do specific things like view a show page, or delete a work.

expect(session[:user_id]).must_equal user.id
end

it "will not login and redirect to root path if not comming from GitHub" do

Choose a reason for hiding this comment

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

👍

must_respond_with :found
end

it "will display a flash message if no user is logged in" do

Choose a reason for hiding this comment

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

👍

@@ -1,6 +1,9 @@
class WorksController < ApplicationController
# We should always be able to tell what category
# of work we're dealing with
# before_action :require_login, only: [:new, :create, :edit, :update, :retired]
before_action :require_login, except: [:root, :upvote] #modify upvote

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants