<commit_before><commit_msg>Add tests for shares_controller (#7835)<commit_after>require 'rails_helper'

describe SharesController do
  render_views

  let(:user) { Fabricate(:user) }
  before { sign_in user }

  describe 'GTE #show' do
    subject(:initial_state_json) { JSON.parse(assigns(:initial_state_json), symbolize_names: true) }
    subject(:body_classes) { assigns(:body_classes) }

    before { get :show, params: { title: 'test title', text: 'test text', url: 'url1 url2' } }

    it 'assigns json' do
      expect(response).to have_http_status :ok
      expect(initial_state_json[:compose][:text]).to eq 'test title test text url1 url2'
      expect(initial_state_json[:meta][:me]).to eq user.account.id.to_s
      expect(body_classes).to eq 'modal-layout compose-standalone'
    end
  end
end
{'fraction_non_alphanumeric': 0.12298136645962733, 'fraction_numerical': 0.009937888198757764, 'mean_word_length': 4.597222222222222, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2223477', 'n_tokens_mistral': 272, 'n_tokens_neox': 259, 'n_words': 63}