blob: de328c08eeff0988dbc98769313c998383939b71 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe AnonyHash do
include AnonyHash
describe 'posts' do
it 'should create an anonymous hash for a post' do
post = build(:post)
expect(get_anony_hash(post)).to_not be_nil
end
end
describe 'tag changes' do
it 'should create an anon hash for a tag change' do
end
it 'should create the same hash for the same user' do
end
it 'should create a different hash for different users' do
end
end
describe 'comments' do
it 'should create an anonymous hash for a comment' do
comment = build(:comment)
expect(get_anony_hash(comment)).to_not be_nil
end
it 'should create the same hash for the same user on the same post' do
comment_one = build(:comment)
comment_two = build(:comment, post: comment_one.post)
expect(get_anony_hash(comment_one)).to eq get_anony_hash(comment_two)
end
it 'should create different hashes for different users on the same post' do
comment_one = build(:comment)
comment_two = build(:comment, post: comment_one.post, ip: '127.0.1.1')
expect(get_anony_hash(comment_one)).to_not eq get_anony_hash(comment_two)
end
end
end
|