2017-04-14 17:37:00 -07:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-04-15 18:40:33 -07:00
|
|
|
describe 'accounts/show.html.haml' do
|
2017-04-14 17:37:00 -07:00
|
|
|
before do
|
2017-04-15 18:40:33 -07:00
|
|
|
allow(view).to receive(:show_landing_strip?).and_return(true)
|
2017-04-14 17:37:00 -07:00
|
|
|
end
|
|
|
|
|
2017-04-15 18:40:33 -07:00
|
|
|
it 'has an h-feed with correct number of h-entry objects in it' do
|
2017-04-14 17:37:00 -07:00
|
|
|
alice = Fabricate(:account, username: 'alice', display_name: 'Alice')
|
|
|
|
status = Fabricate(:status, account: alice, text: 'Hello World')
|
2017-04-15 18:40:33 -07:00
|
|
|
status2 = Fabricate(:status, account: alice, text: 'Hello World Again')
|
|
|
|
status3 = Fabricate(:status, account: alice, text: 'Are You Still There World?')
|
2017-04-14 17:37:00 -07:00
|
|
|
|
|
|
|
assign(:account, alice)
|
2017-04-15 18:40:33 -07:00
|
|
|
assign(:statuses, alice.statuses)
|
|
|
|
assign(:stream_entry, status.stream_entry)
|
|
|
|
assign(:type, status.stream_entry.activity_type.downcase)
|
2017-04-14 17:37:00 -07:00
|
|
|
|
2017-04-15 18:40:33 -07:00
|
|
|
render
|
2017-04-14 17:37:00 -07:00
|
|
|
|
2017-04-15 18:40:33 -07:00
|
|
|
expect(Nokogiri::HTML(rendered).search('.h-feed .h-entry').size).to eq 3
|
2017-04-14 17:37:00 -07:00
|
|
|
end
|
2017-04-22 08:29:46 -07: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-14 17:37:00 -07:00
|
|
|
end
|