mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 17:35:40 +01:00
Convert shares
controller spec to system spec (#31619)
This commit is contained in:
parent
00586d27cb
commit
0ef636f72d
2 changed files with 27 additions and 36 deletions
|
@ -1,22 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe SharesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
before { sign_in user }
|
||||
|
||||
describe 'GET #show' do
|
||||
subject(:body_classes) { assigns(:body_classes) }
|
||||
|
||||
before { get :show, params: { title: 'test title', text: 'test text', url: 'url1 url2' } }
|
||||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status 200
|
||||
expect(body_classes).to eq 'modal-layout compose-standalone'
|
||||
end
|
||||
end
|
||||
end
|
|
@ -2,32 +2,45 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'ShareEntrypoint', :js, :streaming do
|
||||
describe 'Share page', :js, :streaming do
|
||||
include ProfileStories
|
||||
|
||||
subject { page }
|
||||
|
||||
let(:email) { 'test@example.com' }
|
||||
let(:password) { 'password' }
|
||||
let(:confirmed_at) { Time.zone.now }
|
||||
let(:finished_onboarding) { true }
|
||||
|
||||
before do
|
||||
as_a_logged_in_user
|
||||
before { as_a_logged_in_user }
|
||||
|
||||
it 'allows posting a new status' do
|
||||
visit share_path
|
||||
|
||||
expect(page)
|
||||
.to have_css('.modal-layout__mastodon')
|
||||
.and have_css('div#mastodon-compose')
|
||||
.and have_css('.compose-form__submit')
|
||||
|
||||
fill_in_form
|
||||
|
||||
expect(page)
|
||||
.to have_css('.notification-bar-message', text: translations['compose.published.body'])
|
||||
end
|
||||
|
||||
it 'can be used to post a new status' do
|
||||
expect(subject).to have_css('div#mastodon-compose')
|
||||
expect(subject).to have_css('.compose-form__submit')
|
||||
|
||||
status_text = 'This is a new status!'
|
||||
|
||||
def fill_in_form
|
||||
within('.compose-form') do
|
||||
fill_in "What's on your mind?", with: status_text
|
||||
click_on 'Post'
|
||||
fill_in translations['compose_form.placeholder'],
|
||||
with: 'This is a new status!'
|
||||
click_on translations['compose_form.publish']
|
||||
end
|
||||
end
|
||||
|
||||
expect(subject).to have_css('.notification-bar-message', text: 'Post published.')
|
||||
def translations
|
||||
# TODO: Extract to system spec helper for re-use?
|
||||
JSON.parse(
|
||||
Rails
|
||||
.root
|
||||
.join('app', 'javascript', 'mastodon', 'locales', 'en.json')
|
||||
.read
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue