mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-24 13:35:07 +01:00
Remove the react-rails gem (#2801)
* Remove react-rails gem * Fix broken view spec
This commit is contained in:
parent
74c8ca699c
commit
f9d398e8fb
3
Gemfile
3
Gemfile
@ -57,9 +57,6 @@ gem 'twitter-text'
|
|||||||
gem 'tzinfo-data'
|
gem 'tzinfo-data'
|
||||||
gem 'webpacker', '~>1.2'
|
gem 'webpacker', '~>1.2'
|
||||||
|
|
||||||
# For some reason the view specs start failing without this
|
|
||||||
gem 'react-rails'
|
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
gem 'fabrication'
|
gem 'fabrication'
|
||||||
gem 'fuubar'
|
gem 'fuubar'
|
||||||
|
11
Gemfile.lock
11
Gemfile.lock
@ -60,10 +60,6 @@ GEM
|
|||||||
aws-sdk-resources (2.9.14)
|
aws-sdk-resources (2.9.14)
|
||||||
aws-sdk-core (= 2.9.14)
|
aws-sdk-core (= 2.9.14)
|
||||||
aws-sigv4 (1.0.0)
|
aws-sigv4 (1.0.0)
|
||||||
babel-source (5.8.35)
|
|
||||||
babel-transpiler (0.7.0)
|
|
||||||
babel-source (>= 4.0, < 6)
|
|
||||||
execjs (~> 2.0)
|
|
||||||
bcrypt (3.1.11)
|
bcrypt (3.1.11)
|
||||||
better_errors (2.1.1)
|
better_errors (2.1.1)
|
||||||
coderay (>= 1.0.0)
|
coderay (>= 1.0.0)
|
||||||
@ -339,12 +335,6 @@ GEM
|
|||||||
rainbow (2.2.2)
|
rainbow (2.2.2)
|
||||||
rake
|
rake
|
||||||
rake (11.3.0)
|
rake (11.3.0)
|
||||||
react-rails (2.1.0)
|
|
||||||
babel-transpiler (>= 0.7.0)
|
|
||||||
connection_pool
|
|
||||||
execjs
|
|
||||||
railties (>= 3.2)
|
|
||||||
tilt
|
|
||||||
redis (3.3.3)
|
redis (3.3.3)
|
||||||
redis-actionpack (5.0.1)
|
redis-actionpack (5.0.1)
|
||||||
actionpack (>= 4.0, < 6)
|
actionpack (>= 4.0, < 6)
|
||||||
@ -528,7 +518,6 @@ DEPENDENCIES
|
|||||||
rails-i18n
|
rails-i18n
|
||||||
rails-settings-cached
|
rails-settings-cached
|
||||||
rails_12factor
|
rails_12factor
|
||||||
react-rails
|
|
||||||
redis (~> 3.2)
|
redis (~> 3.2)
|
||||||
redis-rails
|
redis-rails
|
||||||
rqrcode
|
rqrcode
|
||||||
|
40
spec/requests/account_show_page_spec.rb
Normal file
40
spec/requests/account_show_page_spec.rb
Normal file
@ -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
|
@ -3,7 +3,11 @@
|
|||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe 'about/_contact.html.haml' do
|
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
|
it 'shows info when account is present' do
|
||||||
account = Account.new(username: 'admin')
|
account = Account.new(username: 'admin')
|
||||||
contact = double(contact_account: account, site_contact_email: '')
|
contact = double(contact_account: account, site_contact_email: '')
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
require 'rails_helper'
|
# frozen_string_literal: true
|
||||||
$LOAD_PATH << '../lib'
|
|
||||||
require 'tag_manager'
|
|
||||||
|
|
||||||
describe 'about/show.html.haml' do
|
require 'rails_helper'
|
||||||
|
|
||||||
|
describe 'about/show.html.haml', without_verify_partial_doubles: true do
|
||||||
before do
|
before do
|
||||||
|
allow(view).to receive(:site_hostname).and_return('example.com')
|
||||||
|
allow(view).to receive(:site_title).and_return('example site')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has valid open graph tags' do
|
it 'has valid open graph tags' do
|
||||||
|
@ -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
|
|
@ -1,12 +1,17 @@
|
|||||||
require 'rails_helper'
|
# frozen_string_literal: true
|
||||||
$LOAD_PATH << '../lib'
|
|
||||||
require 'tag_manager'
|
|
||||||
|
|
||||||
describe 'stream_entries/show.html.haml' do
|
require 'rails_helper'
|
||||||
|
|
||||||
|
describe 'stream_entries/show.html.haml', without_verify_partial_doubles: true do
|
||||||
before do
|
before do
|
||||||
double(:api_oembed_url => '')
|
double(:api_oembed_url => '')
|
||||||
double(:account_stream_entry_url => '')
|
double(:account_stream_entry_url => '')
|
||||||
allow(view).to receive(:show_landing_strip?).and_return(true)
|
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
|
end
|
||||||
|
|
||||||
it 'has valid author h-card and basic data for a detailed_status' do
|
it 'has valid author h-card and basic data for a detailed_status' do
|
||||||
|
Loading…
Reference in New Issue
Block a user