Sha256: d4f13a8f3e14517bb2c7316b4f89d42e4865114a143c3f1dc8565e641a4de9c8
Contents?: true
Size: 1.75 KB
Versions: 1
Compression:
Stored size: 1.75 KB
Contents
require "test_helper" class EmbedExtractorTest < Minitest::Test extend Minitest::Spec::DSL describe "EmbedExtractor" do subject { Govspeak::EmbedExtractor.new(document) } describe "when there is no embedded content" do let(:document) { "foo" } describe "#content_references" do it "returns an empty array" do assert_equal [], subject.content_references end end describe "#content_ids" do it "returns an empty array" do assert_equal [], subject.content_ids end end end describe "when there is embedded content" do let(:contact_uuid) { SecureRandom.uuid } let(:content_block_email_address_uuid) { SecureRandom.uuid } let(:document) do """ {{embed:contact:#{contact_uuid}}} {{embed:content_block_email_address:#{content_block_email_address_uuid}}} """ end describe "#content_references" do it "returns all references" do result = subject.content_references assert_equal 2, result.count assert_equal "contact", result[0].document_type assert_equal contact_uuid, result[0].content_id assert_equal "{{embed:contact:#{contact_uuid}}}", result[0].embed_code assert_equal "content_block_email_address", result[1].document_type assert_equal content_block_email_address_uuid, result[1].content_id assert_equal "{{embed:content_block_email_address:#{content_block_email_address_uuid}}}", result[1].embed_code end end describe "#content_ids" do it "returns all uuids as an array" do assert_equal [contact_uuid, content_block_email_address_uuid], subject.content_ids end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
govspeak-8.5.0 | test/embed_extractor_test.rb |