shares_controller_spec.rb 726 B

12345678910111213141516171819202122
  1. require 'rails_helper'
  2. describe SharesController do
  3. render_views
  4. let(:user) { Fabricate(:user) }
  5. before { sign_in user }
  6. describe 'GTE #show' do
  7. subject(:initial_state_json) { JSON.parse(assigns(:initial_state_json), symbolize_names: true) }
  8. subject(:body_classes) { assigns(:body_classes) }
  9. before { get :show, params: { title: 'test title', text: 'test text', url: 'url1 url2' } }
  10. it 'assigns json' do
  11. expect(response).to have_http_status :ok
  12. expect(initial_state_json[:compose][:text]).to eq 'test title test text url1 url2'
  13. expect(initial_state_json[:meta][:me]).to eq user.account.id.to_s
  14. expect(body_classes).to eq 'modal-layout compose-standalone'
  15. end
  16. end
  17. end