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
da41007e
Commit
da41007e
authored
Jul 21, 2014
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix notify spec
parent
7c401621
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
2 deletions
+22
-2
app/controllers/posts_controller.rb
+0
-1
spec/factories/posts.rb
+1
-1
spec/factories/users.rb
+8
-0
spec/models/notification_spec.rb
+13
-0
No files found.
app/controllers/posts_controller.rb
View file @
da41007e
...
@@ -8,7 +8,6 @@ class PostsController < ApplicationController
...
@@ -8,7 +8,6 @@ class PostsController < ApplicationController
# GET /posts/1
# GET /posts/1
# GET /posts/1.json
# GET /posts/1.json
def
show
def
show
current_user
.
visit_post!
(
@post
)
current_user
.
visit_post!
(
@post
)
@post
.
tags
.
each
do
|
_tag
|
@post
.
tags
.
each
do
|
_tag
|
...
...
spec/factories/posts.rb
View file @
da41007e
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
FactoryGirl
.
define
do
FactoryGirl
.
define
do
factory
:post
do
factory
:post
do
association
:author
,
factory: :alice
association
:author
,
factory: :a
cre
lice
title
'sample title'
title
'sample title'
body
'sample body'
body
'sample body'
specified_date
Date
.
new
(
2014
,
4
,
1
)
specified_date
Date
.
new
(
2014
,
4
,
1
)
...
...
spec/factories/users.rb
View file @
da41007e
...
@@ -40,6 +40,14 @@ FactoryGirl.define do
...
@@ -40,6 +40,14 @@ FactoryGirl.define do
google_token_expires_at
Time
.
now
-
1
.
hour
google_token_expires_at
Time
.
now
-
1
.
hour
end
end
factory
:charley
,
class:
User
do
name
'Charley'
email
'charley@mail.com'
nickname
'charley'
password
Devise
.
friendly_token
[
0
,
20
]
google_token_expires_at
Time
.
now
-
1
.
hour
end
factory
:login_user_1
,
class:
User
do
factory
:login_user_1
,
class:
User
do
name
'Test User'
name
'Test User'
email
'example@example.com'
email
'example@example.com'
...
...
spec/models/notification_spec.rb
View file @
da41007e
...
@@ -17,21 +17,34 @@ require 'rails_helper'
...
@@ -17,21 +17,34 @@ require 'rails_helper'
describe
Notification
do
describe
Notification
do
describe
'Instance method'
do
describe
'Instance method'
do
let
(
:bob
)
{
create
(
:bob
)
}
let
(
:bob
)
{
create
(
:bob
)
}
let
(
:charley
)
{
create
(
:charley
)
}
let
(
:post
)
{
create
(
:post
)
}
let
(
:post
)
{
create
(
:post
)
}
it
"notifies on post edited"
do
it
"notifies on post edited"
do
bob
.
watch!
(
post:
post
)
post
.
update!
(
title:
post
.
title
+
' [New!]'
)
expect
(
bob
.
notifications
.
size
).
to
eq
(
1
)
end
end
it
"notifies on post commented"
do
it
"notifies on post commented"
do
bob
.
watch!
(
post:
post
)
post
.
comments
.
build
(
comment_params
.
merge
(
author:
charley
))
expect
(
bob
.
notifications
.
size
).
to
eq
(
1
)
end
end
it
"set watch on user create a new post"
do
it
"set watch on user create a new post"
do
new_post
=
Post
.
create!
(
author:
bob
,
title:
'title'
,
body:
'body'
)
expect
(
bob
.
watching?
(
post:
new_post
)).
to
be_truthy
end
end
it
"set watch on user edit a post"
do
it
"set watch on user edit a post"
do
post
.
update!
(
author:
bob
,
title:
'new title'
)
expect
(
bob
.
watching?
(
post:
new_post
)).
to
be_truthy
end
end
it
"set watch on user comment a post"
do
it
"set watch on user comment a post"
do
post
.
comments
.
build
(
comment_params
.
merge
(
author:
bob
))
expect
(
bob
.
watching?
(
post:
new_post
)).
to
be_truthy
end
end
end
end
end
end
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