spec/slack/messages/formatting_spec.rb in slack-ruby-client-1.1.0 vs spec/slack/messages/formatting_spec.rb in slack-ruby-client-2.0.0
- old
+ new
@@ -8,46 +8,56 @@
context '#unescape' do
it 'plain text' do
expect(formatting.unescape('plain text')).to eq 'plain text'
end
+
it 'decodes an HTML-encoded message' do
expect(formatting.unescape('Hello & <world>')).to eq 'Hello & <world>'
end
+
it 'unescapes a user reference' do
expect(formatting.unescape('Hey <@U024BE7LH|bob>, did you see my file?')).to(
eq('Hey @bob, did you see my file?')
)
end
+
it 'unescapes a user reference without a name' do
expect(formatting.unescape('<@U02BEFY4U> ^^^')).to eq '@U02BEFY4U ^^^'
end
+
it 'unescapes a URL without text' do
expect(formatting.unescape('This message contains a URL <http://foo.com/>')).to(
eq('This message contains a URL http://foo.com/')
)
end
+
it 'unescapes a URL with text' do
expect(formatting.unescape('So does this one: <http://www.foo.com|www.foo.com>')).to(
eq('So does this one: www.foo.com')
)
end
+
it 'removes mailto' do
expect(formatting.unescape('<mailto:bob@example.com|Bob>')).to eq 'Bob'
end
+
it 'unlinkifies references' do
expect(
formatting.unescape('Hello <@U123|bob>, say hi to <!everyone> in <#C1234|general>')
).to(
eq('Hello @bob, say hi to @everyone in #general')
)
end
+
it 'can handle a lone >' do
expect(formatting.unescape('Hello <@U123|bob> > file.txt')).to eq 'Hello @bob > file.txt'
end
+
it 'unescapes a double smart quote' do
expect(formatting.unescape('“hello”')).to eq '"hello"'
end
+
it 'unescapes a single smart quote' do
expect(formatting.unescape('‘hello’')).to eq "'hello'"
end
end
end