Sha256: d3152aa967346e0683c4785f2e05879f44cc37aa2a75c2c6e309951028940815
Contents?: true
Size: 935 Bytes
Versions: 26
Compression:
Stored size: 935 Bytes
Contents
require 'spec_helper' module NotifyUser describe UserHash do let(:user) { User.create({email: "user@example.com" })} let(:user_hash) { NotifyUser::UserHash.create({target: user, type: "NewPostNotification"})} describe "check hash" do before :each do user_hash.save end it "returns true if hash hasn't be used before" do NotifyUser::UserHash.confirm_hash(user_hash.token,"NewPostNotification").should eq true end it "returns false if hash has been used before" do user_hash.deactivate NotifyUser::UserHash.confirm_hash(user_hash.token,"NewPostNotification").should eq false end it "deactivates hash setting active to false" do user_hash.deactivate user_hash.active.should eq false end it "generates a 44 character hash on create" do user_hash.token.length.should eq 44 end end end end
Version data entries
26 entries across 26 versions & 1 rubygems