2017-04-15 10:37:00 +10:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-04-16 11:40:33 +10:00
|
|
|
describe 'accounts/show.html.haml' do
|
2017-04-15 10:37:00 +10:00
|
|
|
before do
|
2017-04-16 11:40:33 +10:00
|
|
|
allow(view).to receive(:show_landing_strip?).and_return(true)
|
2017-04-15 10:37:00 +10:00
|
|
|
end
|
|
|
|
|
2017-04-16 11:40:33 +10:00
|
|
|
it 'has an h-feed with correct number of h-entry objects in it' do
|
2017-04-15 10:37:00 +10:00
|
|
|
alice = Fabricate(:account, username: 'alice', display_name: 'Alice')
|
|
|
|
status = Fabricate(:status, account: alice, text: 'Hello World')
|
2017-04-16 11:40:33 +10:00
|
|
|
status2 = Fabricate(:status, account: alice, text: 'Hello World Again')
|
|
|
|
status3 = Fabricate(:status, account: alice, text: 'Are You Still There World?')
|
2017-04-15 10:37:00 +10:00
|
|
|
|
|
|
|
assign(:account, alice)
|
2017-04-16 11:40:33 +10:00
|
|
|
assign(:statuses, alice.statuses)
|
|
|
|
assign(:stream_entry, status.stream_entry)
|
|
|
|
assign(:type, status.stream_entry.activity_type.downcase)
|
2017-04-15 10:37:00 +10:00
|
|
|
|
2017-04-16 11:40:33 +10:00
|
|
|
render
|
2017-04-15 10:37:00 +10:00
|
|
|
|
2017-04-16 11:40:33 +10:00
|
|
|
expect(Nokogiri::HTML(rendered).search('.h-feed .h-entry').size).to eq 3
|
2017-04-15 10:37:00 +10:00
|
|
|
end
|
2017-04-23 01:29:46 +10:00
|
|
|
|
|
|
|
it 'has valid opengraph tags' do
|
|
|
|
alice = Fabricate(:account, username: 'alice', display_name: 'Alice')
|
|
|
|
status = Fabricate(:status, account: alice, text: 'Hello World')
|
|
|
|
|
|
|
|
assign(:account, alice)
|
|
|
|
assign(:statuses, alice.statuses)
|
|
|
|
assign(:stream_entry, status.stream_entry)
|
|
|
|
assign(:type, status.stream_entry.activity_type.downcase)
|
|
|
|
|
|
|
|
render
|
|
|
|
|
|
|
|
header_tags = view.content_for(:header_tags)
|
|
|
|
|
|
|
|
expect(header_tags).to match(%r{<meta content='.+' property='og:title'>})
|
|
|
|
expect(header_tags).to match(%r{<meta content='profile' property='og:type'>})
|
|
|
|
expect(header_tags).to match(%r{<meta content='.+' property='og:image'>})
|
|
|
|
expect(header_tags).to match(%r{<meta content='http://.+' property='og:url'>})
|
|
|
|
end
|
2017-04-15 10:37:00 +10:00
|
|
|
end
|