2019-04-29 20:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-07-18 04:28:44 -04:00
|
|
|
RSpec.describe PostReplyKey do
|
|
|
|
describe "#reply_key" do
|
|
|
|
it "should format the reply_key correctly" do
|
2019-01-09 20:56:03 -05:00
|
|
|
hex = SecureRandom.hex
|
2018-07-18 04:28:44 -04:00
|
|
|
post_reply_key = Fabricate(:post_reply_key, reply_key: hex)
|
|
|
|
|
|
|
|
raw_key = PostReplyKey.where(id: post_reply_key.id).pluck("reply_key::text").first
|
|
|
|
|
2019-01-09 20:56:03 -05:00
|
|
|
expect(raw_key).to_not eq(hex)
|
|
|
|
expect(raw_key.delete("-")).to eq(hex)
|
2018-07-18 04:28:44 -04:00
|
|
|
expect(PostReplyKey.find(post_reply_key.id).reply_key).to eq(hex)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|