about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-05-04 17:45:18 -0400
committerEugen Rochko <eugen@zeonfederated.com>2017-05-04 23:45:18 +0200
commitf9d398e8fb2fe17694949ec1654df60298b0004b (patch)
treed5324a858a3512b93f1195cd82e4de1a9882b52a /spec
parent74c8ca699c37ebdb0e3c6f0648f9f90a4f1f8f89 (diff)
Remove the react-rails gem (#2801)
* Remove react-rails gem

* Fix broken view spec
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/account_show_page_spec.rb40
-rw-r--r--spec/views/about/_contact.html.haml_spec.rb6
-rw-r--r--spec/views/about/show.html.haml_spec.rb8
-rw-r--r--spec/views/accounts/show.html.haml_spec.rb42
-rw-r--r--spec/views/stream_entries/show.html.haml_spec.rb11
5 files changed, 58 insertions, 49 deletions
diff --git a/spec/requests/account_show_page_spec.rb b/spec/requests/account_show_page_spec.rb
new file mode 100644
index 000000000..4e51cf7ef
--- /dev/null
+++ b/spec/requests/account_show_page_spec.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe 'The account show page' do
+  it 'Has an h-feed with correct number of h-entry objects in it' do
+    alice = Fabricate(:account, username: 'alice', display_name: 'Alice')
+    _status = Fabricate(:status, account: alice, text: 'Hello World')
+    _status2 = Fabricate(:status, account: alice, text: 'Hello World Again')
+    _status3 = Fabricate(:status, account: alice, text: 'Are You Still There World?')
+
+    get '/@alice'
+
+    expect(h_feed_entries.size).to eq(3)
+  end
+
+  it 'has valid opengraph tags' do
+    alice = Fabricate(:account, username: 'alice', display_name: 'Alice')
+    _status = Fabricate(:status, account: alice, text: 'Hello World')
+
+    get '/@alice'
+
+    expect(head_meta_content('og:title')).to match alice.display_name
+    expect(head_meta_content('og:type')).to eq 'profile'
+    expect(head_meta_content('og:image')).to match '.+'
+    expect(head_meta_content('og:url')).to match 'http://.+'
+  end
+
+  def head_meta_content(property)
+    head_section.meta("[@property='#{property}']")[:content]
+  end
+
+  def head_section
+    Nokogiri::Slop(response.body).html.head
+  end
+
+  def h_feed_entries
+    Nokogiri::HTML(response.body).search('.h-feed .h-entry')
+  end
+end
diff --git a/spec/views/about/_contact.html.haml_spec.rb b/spec/views/about/_contact.html.haml_spec.rb
index 2a6decbce..d2e7a4598 100644
--- a/spec/views/about/_contact.html.haml_spec.rb
+++ b/spec/views/about/_contact.html.haml_spec.rb
@@ -3,7 +3,11 @@
 require 'rails_helper'
 
 describe 'about/_contact.html.haml' do
-  describe 'the contact account' do
+  describe 'the contact account', without_verify_partial_doubles: true do
+    before do
+      allow(view).to receive(:display_name).and_return('Display Name!')
+    end
+
     it 'shows info when account is present' do
       account = Account.new(username: 'admin')
       contact = double(contact_account: account, site_contact_email: '')
diff --git a/spec/views/about/show.html.haml_spec.rb b/spec/views/about/show.html.haml_spec.rb
index 686d393fb..2c5130d84 100644
--- a/spec/views/about/show.html.haml_spec.rb
+++ b/spec/views/about/show.html.haml_spec.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
-$LOAD_PATH << '../lib'
-require 'tag_manager'
 
-describe 'about/show.html.haml' do
+describe 'about/show.html.haml', without_verify_partial_doubles: true do
   before do
+    allow(view).to receive(:site_hostname).and_return('example.com')
+    allow(view).to receive(:site_title).and_return('example site')
   end
 
   it 'has valid open graph tags' do
diff --git a/spec/views/accounts/show.html.haml_spec.rb b/spec/views/accounts/show.html.haml_spec.rb
deleted file mode 100644
index e9f6493b1..000000000
--- a/spec/views/accounts/show.html.haml_spec.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-require 'rails_helper'
-
-describe 'accounts/show.html.haml' do
-  before do
-    allow(view).to receive(:show_landing_strip?).and_return(true)
-  end
-
-  it 'has an h-feed with correct number of h-entry objects in it' do
-    alice   =  Fabricate(:account, username: 'alice', display_name: 'Alice')
-    status  =  Fabricate(:status, account: alice, text: 'Hello World')
-    status2 =  Fabricate(:status, account: alice, text: 'Hello World Again')
-    status3 =  Fabricate(:status, account: alice, text: 'Are You Still There World?')
-
-    assign(:account, alice)
-    assign(:statuses, alice.statuses)
-    assign(:stream_entry, status.stream_entry)
-    assign(:type, status.stream_entry.activity_type.downcase)
-
-    render
-
-    expect(Nokogiri::HTML(rendered).search('.h-feed .h-entry').size).to eq 3
-  end
-
-  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
-end
diff --git a/spec/views/stream_entries/show.html.haml_spec.rb b/spec/views/stream_entries/show.html.haml_spec.rb
index 0dd150524..7cbdf6762 100644
--- a/spec/views/stream_entries/show.html.haml_spec.rb
+++ b/spec/views/stream_entries/show.html.haml_spec.rb
@@ -1,12 +1,17 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
-$LOAD_PATH << '../lib'
-require 'tag_manager'
 
-describe 'stream_entries/show.html.haml' do
+describe 'stream_entries/show.html.haml', without_verify_partial_doubles: true do
   before do
     double(:api_oembed_url => '')
     double(:account_stream_entry_url => '')
     allow(view).to receive(:show_landing_strip?).and_return(true)
+    allow(view).to receive(:site_title).and_return('example site')
+    allow(view).to receive(:site_hostname).and_return('example.com')
+    allow(view).to receive(:full_asset_url).and_return('//asset.host/image.svg')
+    allow(view).to receive(:local_time)
+    allow(view).to receive(:local_time_ago)
   end
 
   it 'has valid author h-card and basic data for a detailed_status' do