diff --git a/.byebug_history b/.byebug_history
index 40d2b53..6966c0b 100644
--- a/.byebug_history
+++ b/.byebug_history
@@ -1,3 +1,31 @@
+quit
+controller.action_name
+controller.action_name "/"
+action_name
+controller.action "/"
+action "/"
+action
+get :new
+get :create
+get :show
+get show
+ get :new, provider: 'github', code: '123', action: "/"
+quit
+get :new, provider: 'github', code: '123', action: "/users/new"
+quit
+get :new, provider: 'github', code: '123', action: "/signin"
+quit
+post :new, provider: 'github', code: '123', action: "/auth/:provider/callback"quit
+post :new, provider: 'github', code: '123', action: "/auth/:provider/callback"
+quit
+quot
+quit
+get :new,provider: 'github', code: '123', action: "/auth/:provider/callback"
+quit
+post :new, provider: 'github', code: '123'
+quit
+get :new
+session[:id]
exit
http://www.example.com/projects/new-project
quit
diff --git a/app/controllers/github_controller.rb b/app/controllers/github_controller.rb
index a6ffa2a..c6cabb3 100644
--- a/app/controllers/github_controller.rb
+++ b/app/controllers/github_controller.rb
@@ -1,6 +1,6 @@
class GithubController < ApplicationController
before_action :authenticate_user!
- before_action :correct_user?, :except => [:index]
+ before_action :correct_user?, :except => [:index, :show]
def index
client = Octokit::Client.new(:access_token => current_user.github_profile.access_token)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index ab2892a..9bad75e 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1,6 +1,6 @@
class UsersController < ApplicationController
before_action :authenticate_user!
- before_action :correct_user?, :except => [:index]
+ before_action :correct_user?, :except => [:index, :show]
def index
@users = User.order('created_at DESC').paginate(page: params[:page], per_page: 30)
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index 5031d82..9698b53 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -1,2 +1,9 @@
User
Name: <%= @user.name if @user.name %>
+
+
+ <% @user.projects.each do |project|%>
+ - <%= link_to "#{project.name}", project_path(project) %>
+ <% end %>
+
+
diff --git a/db/schema.rb b/db/schema.rb
index bcdeab8..5a56615 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,6 @@
#
# It's strongly recommended that you check this file into your version control system.
-
ActiveRecord::Schema.define(version: 20160913142449) do
# These are extensions that must be enabled in order to support this database
diff --git a/spec/features/users/profile_view_spec.rb b/spec/features/users/profile_view_spec.rb
new file mode 100644
index 0000000..4ed6fe0
--- /dev/null
+++ b/spec/features/users/profile_view_spec.rb
@@ -0,0 +1,16 @@
+require 'rails_helper'
+
+feature 'View Profiles'do
+ scenario 'user can view projects of other users in devs' do
+ User.create!(:id => 5, :name => 'Bob')
+ Project.create!(:repo_id => 11111111, :name => "new project", :description => "DELETE", :user_id => 5)
+ visit '/'
+ signin
+ click_link 'Devs'
+ click_link 'Bob'
+ expect(page).to have_selector("ul#projects")
+ click_link 'new project'
+ expect(page).to have_content('tts-datamaster-ee-crack')
+ expect(page).to have_content('DELETE')
+ end
+end
diff --git a/spec/support/fake_github.rb b/spec/support/fake_github.rb
index 5832838..88afafc 100644
--- a/spec/support/fake_github.rb
+++ b/spec/support/fake_github.rb
@@ -3,7 +3,11 @@
class FakeGitHub < Sinatra::Base
get '/repositories/:id' do
- json_response 200, 'repos.json'
+ if params[:id] == 66507460
+ json_response 200, 'repos.json'
+ else
+ json_response 200, 'repos11111111.json'
+ end
end
get '/user/repos' do
diff --git a/spec/support/fixtures/repos.json b/spec/support/fixtures/repos.json
index 890924e..2ed4186 100644
--- a/spec/support/fixtures/repos.json
+++ b/spec/support/fixtures/repos.json
@@ -1,89 +1,9 @@
-
- {
+{
"id": 66507460,
"name": ".atom",
"full_name": "cyberplanner/.atom",
"owner": {
"login": "cyberplanner",
- "id": 16508949,
- "avatar_url": "https://avatars.githubusercontent.com/u/16508949?v=3",
- "gravatar_id": "",
- "url": "https://api.github.com/users/cyberplanner",
- "html_url": "https://github.com/cyberplanner",
- "followers_url": "https://api.github.com/users/cyberplanner/followers",
- "following_url": "https://api.github.com/users/cyberplanner/following{/other_user}",
- "gists_url": "https://api.github.com/users/cyberplanner/gists{/gist_id}",
- "starred_url": "https://api.github.com/users/cyberplanner/starred{/owner}{/repo}",
- "subscriptions_url": "https://api.github.com/users/cyberplanner/subscriptions",
- "organizations_url": "https://api.github.com/users/cyberplanner/orgs",
- "repos_url": "https://api.github.com/users/cyberplanner/repos",
- "events_url": "https://api.github.com/users/cyberplanner/events{/privacy}",
- "received_events_url": "https://api.github.com/users/cyberplanner/received_events",
- "type": "User",
- "site_admin": false
- },
- "private": false,
- "html_url": "https://github.com/cyberplanner/.atom",
- "description": null,
- "fork": false,
- "url": "https://api.github.com/repos/cyberplanner/.atom",
- "forks_url": "https://api.github.com/repos/cyberplanner/.atom/forks",
- "keys_url": "https://api.github.com/repos/cyberplanner/.atom/keys{/key_id}",
- "collaborators_url": "https://api.github.com/repos/cyberplanner/.atom/collaborators{/collaborator}",
- "teams_url": "https://api.github.com/repos/cyberplanner/.atom/teams",
- "hooks_url": "https://api.github.com/repos/cyberplanner/.atom/hooks",
- "issue_events_url": "https://api.github.com/repos/cyberplanner/.atom/issues/events{/number}",
- "events_url": "https://api.github.com/repos/cyberplanner/.atom/events",
- "assignees_url": "https://api.github.com/repos/cyberplanner/.atom/assignees{/user}",
- "branches_url": "https://api.github.com/repos/cyberplanner/.atom/branches{/branch}",
- "tags_url": "https://api.github.com/repos/cyberplanner/.atom/tags",
- "blobs_url": "https://api.github.com/repos/cyberplanner/.atom/git/blobs{/sha}",
- "git_tags_url": "https://api.github.com/repos/cyberplanner/.atom/git/tags{/sha}",
- "git_refs_url": "https://api.github.com/repos/cyberplanner/.atom/git/refs{/sha}",
- "trees_url": "https://api.github.com/repos/cyberplanner/.atom/git/trees{/sha}",
- "statuses_url": "https://api.github.com/repos/cyberplanner/.atom/statuses/{sha}",
- "languages_url": "https://api.github.com/repos/cyberplanner/.atom/languages",
- "stargazers_url": "https://api.github.com/repos/cyberplanner/.atom/stargazers",
- "contributors_url": "https://api.github.com/repos/cyberplanner/.atom/contributors",
- "subscribers_url": "https://api.github.com/repos/cyberplanner/.atom/subscribers",
- "subscription_url": "https://api.github.com/repos/cyberplanner/.atom/subscription",
- "commits_url": "https://api.github.com/repos/cyberplanner/.atom/commits{/sha}",
- "git_commits_url": "https://api.github.com/repos/cyberplanner/.atom/git/commits{/sha}",
- "comments_url": "https://api.github.com/repos/cyberplanner/.atom/comments{/number}",
- "issue_comment_url": "https://api.github.com/repos/cyberplanner/.atom/issues/comments{/number}",
- "contents_url": "https://api.github.com/repos/cyberplanner/.atom/contents/{+path}",
- "compare_url": "https://api.github.com/repos/cyberplanner/.atom/compare/{base}...{head}",
- "merges_url": "https://api.github.com/repos/cyberplanner/.atom/merges",
- "archive_url": "https://api.github.com/repos/cyberplanner/.atom/{archive_format}{/ref}",
- "downloads_url": "https://api.github.com/repos/cyberplanner/.atom/downloads",
- "issues_url": "https://api.github.com/repos/cyberplanner/.atom/issues{/number}",
- "pulls_url": "https://api.github.com/repos/cyberplanner/.atom/pulls{/number}",
- "milestones_url": "https://api.github.com/repos/cyberplanner/.atom/milestones{/number}",
- "notifications_url": "https://api.github.com/repos/cyberplanner/.atom/notifications{?since,all,participating}",
- "labels_url": "https://api.github.com/repos/cyberplanner/.atom/labels{/name}",
- "releases_url": "https://api.github.com/repos/cyberplanner/.atom/releases{/id}",
- "deployments_url": "https://api.github.com/repos/cyberplanner/.atom/deployments",
- "created_at": "2016-08-24T23:38:46Z",
- "updated_at": "2016-08-24T23:38:46Z",
- "pushed_at": "2016-08-24T23:57:05Z",
- "git_url": "git://github.com/cyberplanner/.atom.git",
- "ssh_url": "git@github.com:cyberplanner/.atom.git",
- "clone_url": "https://github.com/cyberplanner/.atom.git",
- "svn_url": "https://github.com/cyberplanner/.atom",
- "homepage": null,
- "size": 46658,
- "stargazers_count": 0,
- "watchers_count": 0,
- "language": null,
- "has_issues": true,
- "has_downloads": true,
- "has_wiki": true,
- "has_pages": false,
- "forks_count": 0,
- "mirror_url": null,
- "open_issues_count": 0,
- "forks": 0,
- "open_issues": 0,
- "watchers": 0,
- "default_branch": "master"
- }
+ "id": 16508949
+ }
+ }
diff --git a/spec/support/fixtures/repos11111111.json b/spec/support/fixtures/repos11111111.json
new file mode 100644
index 0000000..0600ce7
--- /dev/null
+++ b/spec/support/fixtures/repos11111111.json
@@ -0,0 +1,9 @@
+{
+ "id": 11111111,
+ "name": "tts-datamaster-ee-crack",
+ "full_name": "cyberplanner/.atom",
+ "owner": {
+ "login": "cyberplanner",
+ "id": 16508949
+ }
+ }