~srushe/indieweb-authorship

ref: c5a58955573374042c26c38d904ecceaa5e1a702 indieweb-authorship/spec/h-entry-author-email-is-escaped_spec.rb -rw-r--r-- 637 bytes
c5a58955 — Stephen Rushe Support encoded emails within the h-card. 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
RSpec.describe Indieweb::Authorship do
  let(:page) { 'h-entry-author-email-is-escaped' }
  let(:url) { "https://beesbuzz.biz/" }
  let(:html) { html_for(page) }
  let(:expected_data) do
    {
      'url' => url,
      'name' => 'fluffy',
      'photo' => 'https://beesbuzz.biz/static/headshot.jpg'
    }
  end

  before do
    allow(Net::HTTP).to receive(:get).with(URI(url)) { html }
  end

  context 'when given just a URL' do
    it { expect(described_class.identify(url)).to eq expected_data }
  end

  context 'when given both a URL and HTML' do
    it { expect(described_class.identify(url, html)).to eq expected_data }
  end
end