diff --git a/spec/controllers/shares_controller_spec.rb b/spec/controllers/shares_controller_spec.rb deleted file mode 100644 index 5dcc46e47..000000000 --- a/spec/controllers/shares_controller_spec.rb +++ /dev/null @@ -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 diff --git a/spec/system/share_entrypoint_spec.rb b/spec/system/share_entrypoint_spec.rb index 5fdbeacef..5e27781f2 100644 --- a/spec/system/share_entrypoint_spec.rb +++ b/spec/system/share_entrypoint_spec.rb @@ -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