Sha256: bd1173eb7d30795b3880008f9b8bbaca4f4e340982b2f69044706edb01772f0f
Contents?: true
Size: 1 KB
Versions: 11
Compression:
Stored size: 1 KB
Contents
require "test_helper" module CensorBear class DataIdTest < ActiveSupport::TestCase setup do @comment = FactoryBot.create(:comment) end test "could check data id format correctly when everything is good" do raw = CensorBear::TextDataId.encode(@comment, user_id: "1", ip_address: "127.0.0.1") assert_equal true, CensorBear::TextDataId.valid?(raw) end test "could check data id format correctly when klass_name is not defined" do raw = "NotDefined-1-1-1" assert_equal false, CensorBear::TextDataId.valid?(raw) end test "could check data id format correctly when klass_id is not defined" do raw = "Comment--1-1" assert_equal false, CensorBear::TextDataId.valid?(raw) end test "could init object during data_id" do raw = CensorBear::TextDataId.encode(@comment, user_id: "1", ip_address: "127.0.0.1") text_data_id = CensorBear::TextDataId.new(raw) assert_equal @comment.class.to_s, text_data_id.record.class.to_s end end end
Version data entries
11 entries across 11 versions & 1 rubygems