about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-07-08 14:51:05 +0200
committerGitHub <noreply@github.com>2017-07-08 14:51:05 +0200
commit864e3f8d9ca652e10a28bddbb0d0df629d2849d4 (patch)
tree3fb2f9c97fca49cc467622ab532252f8044146f6 /spec
parent102466ac5842b20f32a9c5e2fa3f35414c34574b (diff)
Replace OEmbed and initial state Rabl templates with serializers (#4110)
* Replace OEmbed Rabl template with serializer

* Replace initial state rabl with serializer
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/home_controller_spec.rb41
1 files changed, 7 insertions, 34 deletions
diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb
index cc1dbe5a1..d44d720b1 100644
--- a/spec/controllers/home_controller_spec.rb
+++ b/spec/controllers/home_controller_spec.rb
@@ -23,41 +23,14 @@ RSpec.describe HomeController, type: :controller do
         expect(assigns(:body_classes)).to eq 'app-body'
       end
 
-      it 'assigns @token' do
-        app = Doorkeeper::Application.create!(name: 'Web', superapp: true, redirect_uri: Doorkeeper.configuration.native_redirect_uri)
-        allow(Doorkeeper.configuration).to receive(:access_token_expires_in).and_return(42)
-
-        subject
-        token = Doorkeeper::AccessToken.find_by(token: assigns(:token))
-
-        expect(token.application).to eq app
-        expect(token.resource_owner_id).to eq user.id
-        expect(token.scopes).to eq Doorkeeper::OAuth::Scopes.from_string('read write follow')
-        expect(token.expires_in_seconds).to eq 42
-        expect(token.use_refresh_token?).to eq false
-      end
-
-      it 'assigns @web_settings for {} if not available' do
-        subject
-        expect(assigns(:web_settings)).to eq({})
-      end
-
-      it 'assigns @web_settings for Web::Setting if available' do
-        setting = Fabricate('Web::Setting', data: '{"home":{}}', user: user)
-        subject
-        expect(assigns(:web_settings)).to eq setting.data
-      end
-
-      it 'assigns @admin' do
-        admin = Fabricate(:account)
-        Setting.site_contact_username = admin.username
-        subject
-        expect(assigns(:admin)).to eq admin
-      end
-
-      it 'assigns streaming_api_base_url' do
+      it 'assigns @initial_state_json' do
         subject
-        expect(assigns(:streaming_api_base_url)).to eq 'ws://localhost:4000'
+        initial_state_json = json_str_to_hash(assigns(:initial_state_json))
+        expect(initial_state_json[:meta]).to_not be_nil
+        expect(initial_state_json[:compose]).to_not be_nil
+        expect(initial_state_json[:accounts]).to_not be_nil
+        expect(initial_state_json[:settings]).to_not be_nil
+        expect(initial_state_json[:media_attachments]).to_not be_nil
       end
     end
   end