2019-04-29 19:27:42 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-07-18 03:28:44 -05:00
|
|
|
RSpec.describe PostReplyKey do
|
|
|
|
describe "#reply_key" do
|
|
|
|
it "should format the reply_key correctly" do
|
2019-01-09 19:56:03 -06:00
|
|
|
hex = SecureRandom.hex
|
2018-07-18 03:28:44 -05: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 19:56:03 -06:00
|
|
|
expect(raw_key).to_not eq(hex)
|
|
|
|
expect(raw_key.delete("-")).to eq(hex)
|
2018-07-18 03:28:44 -05:00
|
|
|
expect(PostReplyKey.find(post_reply_key.id).reply_key).to eq(hex)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|