Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rendezvous
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VeNtura
rendezvous
Commits
8022da91
Commit
8022da91
authored
Jul 19, 2014
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix rspec and `sign_in`
parent
1e92221c
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
114 additions
and
75 deletions
+114
-75
app/controllers/users_controller.rb
+6
-6
app/models/notification.rb
+14
-0
app/models/tag.rb
+7
-6
app/views/partials/_app_header.html.slim
+1
-1
app/views/users/_form.html.slim
+4
-4
app/views/users/edit.html.slim
+0
-0
app/views/users/update.html.slim
+0
-0
config/routes.rb
+10
-2
spec/controllers/apis_controller_spec.rb
+3
-3
spec/controllers/flow_controller_spec.rb
+3
-3
spec/controllers/search_controller_spec.rb
+3
-3
spec/controllers/stock_controller_spec.rb
+3
-3
spec/controllers/tags_controller_spec.rb
+3
-3
spec/controllers/users_controller_spec.rb
+6
-7
spec/controllers/welcome_controller_spec.rb
+7
-6
spec/factories/tags.rb
+7
-6
spec/models/notification_spec.rb
+14
-0
spec/models/post_spec.rb
+9
-9
spec/models/tag_spec.rb
+11
-10
spec/models/user_spec.rb
+2
-2
spec/spec_helper.rb
+1
-1
No files found.
app/controllers/
me
_controller.rb
→
app/controllers/
users
_controller.rb
View file @
8022da91
class
MeController
<
ApplicationController
class
UsersController
<
ApplicationController
before_action
:set_user
,
only:
[
:edit
,
:update
]
before_action
:set_user
,
only:
[
:edit
,
:update
]
def
edit
def
edit
...
@@ -6,21 +7,20 @@ class MeController < ApplicationController
...
@@ -6,21 +7,20 @@ class MeController < ApplicationController
def
update
def
update
respond_to
do
|
format
|
respond_to
do
|
format
|
if
@
me
.
update
(
user_params
)
if
@
user
.
update
(
user_params
)
format
.
html
{
redirect_to
edit_
me
_path
,
flash:
{
notice:
'Post was successfully updated.'
}
}
format
.
html
{
redirect_to
edit_
user
_path
,
flash:
{
notice:
'Post was successfully updated.'
}
}
format
.
json
{
head
:no_content
}
format
.
json
{
head
:no_content
}
else
else
format
.
html
{
render
action:
'edit'
}
format
.
html
{
render
action:
'edit'
}
format
.
json
{
render
json:
@
me
.
errors
,
status: :unprocessable_entity
}
format
.
json
{
render
json:
@
user
.
errors
,
status: :unprocessable_entity
}
end
end
end
end
end
end
private
private
# Use callbacks to share common setup or constraints between actions.
def
set_user
def
set_user
@
me
=
current_user
@
user
=
current_user
end
end
def
user_params
def
user_params
...
...
app/models/notification.rb
View file @
8022da91
# == Schema Information
#
# Table name: notifications
#
# id :integer not null, primary key
# user_id :integer
# read_at :datetime
# is_read :boolean default(FALSE), not null
# detail_path :string(255)
# body :text
# created_at :datetime
# updated_at :datetime
#
class
Notification
<
ActiveRecord
::
Base
class
Notification
<
ActiveRecord
::
Base
belongs_to
:user
belongs_to
:user
...
...
app/models/tag.rb
View file @
8022da91
...
@@ -2,12 +2,13 @@
...
@@ -2,12 +2,13 @@
#
#
# Table name: tags
# Table name: tags
#
#
# id :integer not null, primary key
# id :integer not null, primary key
# name :string(255)
# name :string(255)
# created_at :datetime
# created_at :datetime
# updated_at :datetime
# updated_at :datetime
# ancestry :string(255)
# ancestry :string(255)
# body :text
# body :text
# posts_count :integer default(0), not null
#
#
class
Tag
<
ActiveRecord
::
Base
class
Tag
<
ActiveRecord
::
Base
...
...
app/views/partials/_app_header.html.slim
View file @
8022da91
...
@@ -37,7 +37,7 @@ nav.navbar.navbar-default.navbar-fixed-top role="navigation"
...
@@ -37,7 +37,7 @@ nav.navbar.navbar-default.navbar-fixed-top role="navigation"
|
下書き
|
下書き
span
.badge.pull-right
=
current_user
.
decorate
.
draft_count
span
.badge.pull-right
=
current_user
.
decorate
.
draft_count
li
li
a
href
=
edit_user_
registration_
path
マイページ
a
href
=
edit_user_path
マイページ
li
.divider
li
.divider
li
li
a
href
=
destroy_user_session_path
data-method
=
"delete"
rel
=
"nofollow"
SignOut
a
href
=
destroy_user_session_path
data-method
=
"delete"
rel
=
"nofollow"
SignOut
...
...
app/views/
me
/_form.html.slim
→
app/views/
users
/_form.html.slim
View file @
8022da91
#post-form
#post-form
=
form_for
(
@
me
,
url:
me
_path
)
do
|
f
|
=
form_for
(
@
user
,
url:
user
_path
)
do
|
f
|
-
if
@
me
.
errors
.
any?
-
if
@
user
.
errors
.
any?
#error_explanation
#error_explanation
h2
h2
=
pluralize
(
@
me
.
errors
.
count
,
"error"
)
=
pluralize
(
@
user
.
errors
.
count
,
"error"
)
|
prohibited this post from being saved:
|
prohibited this post from being saved:
ul
ul
-
@
me
.
errors
.
full_messages
.
each
do
|
msg
|
-
@
user
.
errors
.
full_messages
.
each
do
|
msg
|
li
=
msg
li
=
msg
.row
.row
...
...
app/views/
me
/edit.html.slim
→
app/views/
users
/edit.html.slim
View file @
8022da91
File moved
app/views/
me
/update.html.slim
→
app/views/
users
/update.html.slim
View file @
8022da91
File moved
config/routes.rb
View file @
8022da91
...
@@ -26,8 +26,16 @@ Rendezvous::Application.routes.draw do
...
@@ -26,8 +26,16 @@ Rendezvous::Application.routes.draw do
devise_for
:users
,
devise_for
:users
,
path_names:
{
current_user:
'me'
},
path_names:
{
current_user:
'me'
},
controllers:
{
omniauth_callbacks:
'users/omniauth_callbacks'
},
controllers:
{
skip:
[
:passwords
]
omniauth_callbacks:
'users/omniauth_callbacks'
,
registrations:
'users/registrations'
},
skip:
[
:passwords
,
:registrations
,
]
resource
:user
# The priority is based upon order of creation: first created -> highest priority.
# The priority is based upon order of creation: first created -> highest priority.
...
...
spec/controllers/apis_controller_spec.rb
View file @
8022da91
require
'spec_helper'
require
'spec_helper'
describe
ApisController
do
describe
ApisController
,
type: :controller
do
describe
"GET 'markdown_preview'"
do
describe
"GET 'markdown_preview'"
do
it
"returns http redirect"
do
it
"returns http redirect"
do
...
@@ -10,9 +10,9 @@ describe ApisController do
...
@@ -10,9 +10,9 @@ describe ApisController do
end
end
describe
"GET 'markdown_preview'"
do
describe
"GET 'markdown_preview'"
do
login_user
it
"returns http success"
do
it
"returns http success"
do
sign_in
FactoryGirl
.
create
(
:alice
)
get
'markdown_preview'
get
'markdown_preview'
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
end
end
...
...
spec/controllers/flow_controller_spec.rb
View file @
8022da91
require
'spec_helper'
require
'spec_helper'
describe
FlowController
do
describe
FlowController
,
type: :controller
do
describe
"GET 'show' without login"
do
describe
"GET 'show' without login"
do
it
"returns http redirect"
do
it
"returns http redirect"
do
...
@@ -10,9 +10,9 @@ describe FlowController do
...
@@ -10,9 +10,9 @@ describe FlowController do
end
end
describe
"GET 'show' with login"
do
describe
"GET 'show' with login"
do
login_user
it
"returns http success"
do
it
"returns http success"
do
sign_in
FactoryGirl
.
create
(
:alice
)
get
'show'
get
'show'
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
end
end
...
...
spec/controllers/search_controller_spec.rb
View file @
8022da91
require
'spec_helper'
require
'spec_helper'
describe
SearchController
do
describe
SearchController
,
type: :controller
do
describe
"GET 'show' without login"
do
describe
"GET 'show' without login"
do
it
"returns http redirect"
do
it
"returns http redirect"
do
...
@@ -10,9 +10,9 @@ describe SearchController do
...
@@ -10,9 +10,9 @@ describe SearchController do
end
end
describe
"GET 'show' with login"
do
describe
"GET 'show' with login"
do
login_user
it
"returns http success"
do
it
"returns http success"
do
sign_in
FactoryGirl
.
create
(
:alice
)
get
'show'
get
'show'
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
end
end
...
...
spec/controllers/stock_controller_spec.rb
View file @
8022da91
require
'spec_helper'
require
'spec_helper'
describe
StockController
do
describe
StockController
,
type: :controller
do
describe
"GET 'show' without login"
do
describe
"GET 'show' without login"
do
it
"returns http redirect"
do
it
"returns http redirect"
do
...
@@ -10,9 +10,9 @@ describe StockController do
...
@@ -10,9 +10,9 @@ describe StockController do
end
end
describe
"GET 'show' with login"
do
describe
"GET 'show' with login"
do
login_user
it
"returns http success"
do
it
"returns http success"
do
sign_in
FactoryGirl
.
create
(
:alice
)
get
'show'
get
'show'
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
end
end
...
...
spec/controllers/tags_controller_spec.rb
View file @
8022da91
require
'spec_helper'
require
'spec_helper'
describe
TagsController
do
describe
TagsController
,
type: :controller
do
let
(
:tag
)
{
FactoryGirl
.
create
(
:tag_ruby
)
}
let
(
:tag
)
{
FactoryGirl
.
create
(
:tag_ruby
)
}
...
@@ -12,9 +12,9 @@ describe TagsController do
...
@@ -12,9 +12,9 @@ describe TagsController do
end
end
describe
"GET 'show' with login"
do
describe
"GET 'show' with login"
do
login_user
it
"returns http success"
do
it
"returns http success"
do
sign_in
FactoryGirl
.
create
(
:alice
)
get
'show'
,
name:
tag
.
name
get
'show'
,
name:
tag
.
name
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
end
end
...
...
spec/controllers/
me
_controller_spec.rb
→
spec/controllers/
users
_controller_spec.rb
View file @
8022da91
require
'spec_helper'
require
'spec_helper'
describe
MeController
do
describe
UsersController
,
type: :controller
do
before
do
end
describe
"GET 'edit'"
do
describe
"GET 'edit'"
do
login_user
it
"returns http success"
do
it
"returns http success"
do
sign_in
FactoryGirl
.
create
(
:alice
)
get
:edit
get
:edit
response
.
should
be_success
response
.
should
be_success
end
end
end
end
describe
"GET 'update'"
do
describe
"GET 'update'"
do
login_user
it
"returns http success"
do
it
"returns http success"
do
sign_in
FactoryGirl
.
create
(
:alice
)
patch
:update
,
user:
{
nickname:
'bob'
}
patch
:update
,
user:
{
nickname:
'bob'
}
response
.
should
redirect_to
(
'/
me
/edit'
)
response
.
should
redirect_to
(
'/
user
/edit'
)
end
end
end
end
...
...
spec/controllers/welcome_controller_spec.rb
View file @
8022da91
require
'spec_helper'
require
'spec_helper'
describe
WelcomeController
do
describe
WelcomeController
,
type: :controller
do
describe
"GET 'top'"
do
describe
"GET 'top'"
do
it
'should be successful'
do
it
'should be successful'
do
...
@@ -12,22 +12,23 @@ describe WelcomeController do
...
@@ -12,22 +12,23 @@ describe WelcomeController do
describe
'Login'
do
describe
'Login'
do
before
(
:each
)
do
let
(
:user
)
{
FactoryGirl
.
create
(
:alice
)
}
@user
=
FactoryGirl
.
create
(
:login_user_1
)
sign_in
@user
end
describe
"GET 'top'"
do
describe
"GET 'top'"
do
it
'should be successful'
do
it
'should be successful'
do
sign_in
FactoryGirl
.
create
(
:alice
)
get
:top
get
:top
expect
(
subject
).
to
redirect_to
controller:
'flow'
,
expect
(
subject
).
to
redirect_to
controller:
'flow'
,
action:
'show'
action:
'show'
end
end
it
'should find the right user'
do
it
'should find the right user'
do
sign_in
user
get
:top
get
:top
expect
(
assigns
(
:current_user
)).
to
eq
(
@
user
)
expect
(
assigns
(
:current_user
)).
to
eq
(
user
)
end
end
end
end
...
...
spec/factories/tags.rb
View file @
8022da91
...
@@ -2,12 +2,13 @@
...
@@ -2,12 +2,13 @@
#
#
# Table name: tags
# Table name: tags
#
#
# id :integer not null, primary key
# id :integer not null, primary key
# name :string(255)
# name :string(255)
# created_at :datetime
# created_at :datetime
# updated_at :datetime
# updated_at :datetime
# ancestry :string(255)
# ancestry :string(255)
# body :text
# body :text
# posts_count :integer default(0), not null
#
#
# Read about factories at https://github.com/thoughtbot/factory_girl
# Read about factories at https://github.com/thoughtbot/factory_girl
...
...
spec/models/notification_spec.rb
View file @
8022da91
# == Schema Information
#
# Table name: notifications
#
# id :integer not null, primary key
# user_id :integer
# read_at :datetime
# is_read :boolean default(FALSE), not null
# detail_path :string(255)
# body :text
# created_at :datetime
# updated_at :datetime
#
require
'spec_helper'
require
'spec_helper'
describe
Notification
do
describe
Notification
do
...
...
spec/models/post_spec.rb
View file @
8022da91
...
@@ -70,42 +70,42 @@ describe Post do
...
@@ -70,42 +70,42 @@ describe Post do
end
end
it
'by id'
do
it
'by id'
do
expect
(
Post
.
search
(
'id:1001'
)
).
to
have
(
1
).
items
expect
(
Post
.
search
(
'id:1001'
)
.
size
).
to
eq
(
1
)
expect
(
Post
.
search
(
'id:1001'
)).
to
include
(
@post1
)
expect
(
Post
.
search
(
'id:1001'
)).
to
include
(
@post1
)
end
end
it
'by title'
do
it
'by title'
do
expect
(
Post
.
search
(
'title:ruby'
)
).
to
have
(
2
).
items
expect
(
Post
.
search
(
'title:ruby'
)
.
size
).
to
eq
(
2
)
expect
(
Post
.
search
(
'title:ruby'
)).
to
include
(
@post1
)
expect
(
Post
.
search
(
'title:ruby'
)).
to
include
(
@post1
)
end
end
it
'by body'
do
it
'by body'
do
expect
(
Post
.
search
(
'body:ruby'
)
).
to
have
(
2
).
items
expect
(
Post
.
search
(
'body:ruby'
)
.
size
).
to
eq
(
2
)
expect
(
Post
.
search
(
'body:ruby'
)).
to
include
(
@post3
)
expect
(
Post
.
search
(
'body:ruby'
)).
to
include
(
@post3
)
end
end
it
'by @<author_name>'
do
it
'by @<author_name>'
do
expect
(
Post
.
search
(
'@Alice'
)
).
to
have
(
1
).
items
expect
(
Post
.
search
(
'@Alice'
)
.
size
).
to
eq
(
1
)
expect
(
Post
.
search
(
'@Alice'
)).
to
include
(
@post2
)
expect
(
Post
.
search
(
'@Alice'
)).
to
include
(
@post2
)
end
end
it
'by #<tag_name>'
do
it
'by #<tag_name>'
do
expect
(
Post
.
search
(
'#java'
)
).
to
have
(
1
).
items
expect
(
Post
.
search
(
'#java'
)
.
size
).
to
eq
(
1
)
expect
(
Post
.
search
(
'#java'
)).
to
include
(
@post3
)
expect
(
Post
.
search
(
'#java'
)).
to
include
(
@post3
)
end
end
it
'by date'
do
it
'by date'
do
expect
(
Post
.
search
(
'date:1989-2-25'
)
).
to
have
(
1
).
items
expect
(
Post
.
search
(
'date:1989-2-25'
)
.
size
).
to
eq
(
1
)
expect
(
Post
.
search
(
'date:1989-2-25'
)).
to
include
(
@post3
)
expect
(
Post
.
search
(
'date:1989-2-25'
)).
to
include
(
@post3
)
end
end
it
'by draft'
do
it
'by draft'
do
expect
(
Post
.
search
(
'ruby'
)
).
to
have
(
3
).
items
expect
(
Post
.
search
(
'ruby'
)
.
size
).
to
eq
(
3
)
expect
(
Post
.
search
(
'ruby draft:1'
)
).
to
have
(
1
).
items
expect
(
Post
.
search
(
'ruby draft:1'
)
.
size
).
to
eq
(
1
)
end
end
it
'by else'
do
it
'by else'
do
expect
(
Post
.
search
(
'ruby'
)
).
to
have
(
3
).
items
expect
(
Post
.
search
(
'ruby'
)
.
size
).
to
eq
(
3
)
expect
(
Post
.
search
(
'ruby'
)).
to
include
(
@post1
)
expect
(
Post
.
search
(
'ruby'
)).
to
include
(
@post1
)
expect
(
Post
.
search
(
'ruby'
)).
to
include
(
@post3
)
expect
(
Post
.
search
(
'ruby'
)).
to
include
(
@post3
)
end
end
...
...
spec/models/tag_spec.rb
View file @
8022da91
...
@@ -2,12 +2,13 @@
...
@@ -2,12 +2,13 @@
#
#
# Table name: tags
# Table name: tags
#
#
# id :integer not null, primary key
# id :integer not null, primary key
# name :string(255)
# name :string(255)
# created_at :datetime
# created_at :datetime
# updated_at :datetime
# updated_at :datetime
# ancestry :string(255)
# ancestry :string(255)
# body :text
# body :text
# posts_count :integer default(0), not null
#
#
require
'spec_helper'
require
'spec_helper'
...
@@ -23,11 +24,11 @@ describe Tag do
...
@@ -23,11 +24,11 @@ describe Tag do
end
end
it
'successfully moved'
do
it
'successfully moved'
do
expect
(
Tag
.
find_by
(
name:
'ruby'
).
posts
).
to
have
(
2
).
items
expect
(
Tag
.
find_by
(
name:
'ruby'
).
posts
.
size
).
to
eq
(
2
)
expect
(
Tag
.
find_by
(
name:
'java'
).
posts
).
to
have
(
2
).
items
expect
(
Tag
.
find_by
(
name:
'java'
).
posts
.
size
).
to
eq
(
2
)
@tag_java
.
move_all_posts_to!
(
@tag_ruby
)
@tag_java
.
move_all_posts_to!
(
@tag_ruby
)
expect
(
Tag
.
find_by
(
name:
'ruby'
).
posts
).
to
have
(
3
).
items
expect
(
Tag
.
find_by
(
name:
'ruby'
).
posts
.
size
).
to
eq
(
3
)
expect
(
Tag
.
find_by
(
name:
'java'
).
posts
).
to
have
(
0
).
items
expect
(
Tag
.
find_by
(
name:
'java'
).
posts
.
size
).
to
eq
(
0
)
end
end
end
end
...
...
spec/models/user_spec.rb
View file @
8022da91
...
@@ -35,11 +35,11 @@ describe User do
...
@@ -35,11 +35,11 @@ describe User do
describe
'#google_oauth_token_expired?'
do
describe
'#google_oauth_token_expired?'
do
it
'not expired'
do
it
'not expired'
do
expect
(
alice
.
google_oauth_token_expired?
).
to
be_false
expect
(
alice
.
google_oauth_token_expired?
).
to
be_false
y
end
end
it
'expired'
do
it
'expired'
do
expect
(
bob
.
google_oauth_token_expired?
).
to
be_tru
e
expect
(
bob
.
google_oauth_token_expired?
).
to
be_tru
thy
end
end
end
end
...
...
spec/spec_helper.rb
View file @
8022da91
...
@@ -95,7 +95,7 @@ RSpec.configure do |config|
...
@@ -95,7 +95,7 @@ RSpec.configure do |config|
end
end
config
.
include
Devise
::
TestHelpers
,
:type
=>
:controller
config
.
include
Devise
::
TestHelpers
,
:type
=>
:controller
config
.
extend
ControllerMacros
,
:type
=>
:controller
#
config.extend ControllerMacros, :type => :controller
# Capybara.app_host = "http://127.0.0.1/"
# Capybara.app_host = "http://127.0.0.1/"
register_poltergeist
(
config
)
register_poltergeist
(
config
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment