# 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